Created
July 12, 2013 01:33
-
-
Save ericmoritz/5980747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Config (Config, config, dir, enqueue) where | |
| import Data.Sequence (Seq, empty, (|>)) | |
| import qualified Data.Foldable as F | |
| data Config = Config { | |
| dir :: String | |
| , seq :: Seq String | |
| } deriving (Show) | |
| config dir = | |
| Config dir empty | |
| enqueue :: Config -> [String] -> Config | |
| c `enqueue` urls = | |
| Config (dir c) q' | |
| where | |
| q' = foldl (|>) (Config.seq c) urls | |
| -- TODO: make an instance of Foldable? | |
| instance F.Foldable Config where | |
| foldr f z c = | |
| Config (dir c) q' | |
| where | |
| q' = F.foldr f z (Config.seq c) | |
| foldMap f c = | |
| Config (dir c) q' | |
| where | |
| q' = F.foldMap f (Config.seq c) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error: