Skip to content

Commit

Permalink
fix(cabal extensions): read all the extensions from the Cabal file
Browse files Browse the repository at this point in the history
Fixes #27
  • Loading branch information
rubik committed Jun 16, 2016
1 parent 28e34ee commit bf85abf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Argon/Cabal.hs
Expand Up @@ -2,6 +2,7 @@
module Argon.Cabal (flagsMap, parseExts)
where

import Data.List (nub)
import Data.Maybe (mapMaybe)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as M
Expand Down Expand Up @@ -31,11 +32,13 @@ parseExts path = extract <$> Dist.readPackageDescription Dist.silent path
(Dist.libBuildInfo . Dist.condTreeData) <$> Dist.condLibrary pkg

extFromBI :: Dist.BuildInfo -> [GHC.ExtensionFlag]
extFromBI = mapMaybe (get . toString) . Dist.defaultExtensions
extFromBI binfo = mapMaybe (get . toString) . nub $ allExts
where get = flip M.lookup flagsMap
toString (Dist.UnknownExtension ext) = ext
toString (Dist.EnableExtension ext) = show ext
toString (Dist.DisableExtension ext) = show ext
allExts = concatMap ($ binfo) $
[Dist.defaultExtensions, Dist.otherExtensions, Dist.oldExtensions]

#if __GLASGOW_HASKELL__ < 710
specToPair :: (String, GHC.ExtensionFlag, a) -> (String, GHC.ExtensionFlag)
Expand Down

0 comments on commit bf85abf

Please sign in to comment.