Created
January 18, 2017 06:20
-
-
Save chris-martin/67274e6a8a79a89dd932582c8b3669c3 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
newtype ConjList a = ConjList [a] deriving Show | |
instance Monoid a => Monoid (ConjList a) where | |
mempty = ConjList $ repeat mempty | |
mappend (ConjList x) (ConjList y) = ConjList $ zipWith mappend x y | |
λ> mappend (ConjList ["ab", "cd"]) (ConjList ["xc", "xy", "xp"]) | |
ConjList ["abxc","cdxy"] | |
it :: (Monoid a, Data.String.IsString a) => ConjList a | |
λ> mappend (ConjList ["ab", "cd"]) mempty | |
ConjList ["ab","cd"] | |
it :: (Monoid a, Data.String.IsString a) => ConjList a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment