{-# language ApplicativeDo #-}
{-# language BlockArguments #-}
{-# language OverloadedStrings #-}
{-# language RecordWildCards #-}
module Weeder.Config ( Config(..), config ) where
import Data.Set ( Set )
import qualified Data.Set as Set
import qualified Dhall
data Config = Config
{ Config -> Set String
rootPatterns :: Set String
, Config -> Bool
typeClassRoots :: Bool
}
config :: Dhall.Decoder Config
config :: Decoder Config
config =
RecordDecoder Config -> Decoder Config
forall a. RecordDecoder a -> Decoder a
Dhall.record do
Set String
rootPatterns <- [String] -> Set String
forall a. Ord a => [a] -> Set a
Set.fromList ([String] -> Set String)
-> RecordDecoder [String] -> RecordDecoder (Set String)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Decoder [String] -> RecordDecoder [String]
forall a. Text -> Decoder a -> RecordDecoder a
Dhall.field Text
"roots" ( Decoder String -> Decoder [String]
forall a. Decoder a -> Decoder [a]
Dhall.list Decoder String
Dhall.string )
Bool
typeClassRoots <- Text -> Decoder Bool -> RecordDecoder Bool
forall a. Text -> Decoder a -> RecordDecoder a
Dhall.field Text
"type-class-roots" Decoder Bool
Dhall.bool
return Config :: Set String -> Bool -> Config
Config{Bool
Set String
typeClassRoots :: Bool
rootPatterns :: Set String
typeClassRoots :: Bool
rootPatterns :: Set String
..}