Created
January 6, 2011 03:34
-
-
Save duairc/767465 to your computer and use it in GitHub Desktop.
This file contains 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
loadTemplates path = readDirectoryWith reader path | |
>>= (free | |
-- DirTree (Maybe (FilePath, Either String ByteString)) | |
>>> F.toList | |
-- [Maybe (String, Either String ByteString)] | |
>>> catMaybes | |
-- [(String, Either String ByteString)] | |
>>> unzip | |
-- ([String], [Either String ByteString]) | |
>>> second partitionEithers | |
-- ([String], ([String], [ByteString])) | |
>>> second (first unlines) | |
-- ([String], (String, [ByteString])) | |
>>> subr | |
-- (String, ([String], [ByteString])) | |
>>> second (uncurry zip) | |
-- (String, [(String, ByteString)]) | |
>>> second (map (first U.fromString)) | |
-- (String, [(ByteString, ByteString)]) | |
>>> second M.fromList | |
-- (String, Map ByteString ByteString) | |
>>> join (fmap toEither $ null . fst) | |
-- Either String (Map ByteString ByteString) | |
>>> return) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment