Commit before picture change
This commit is contained in:
@@ -25,6 +25,18 @@ instance Foldable FTree where
|
||||
foldMap g (FLeaf x) = g x
|
||||
{-# INLINE foldMap #-}
|
||||
|
||||
data LTree a
|
||||
= LBranches [LTree a]
|
||||
| LLeaf a
|
||||
instance Foldable LTree where
|
||||
foldMap g (LBranches ts) = mconcat $ map (foldMap g) ts
|
||||
foldMap g (LLeaf a) = g a
|
||||
{-# INLINE foldMap #-}
|
||||
instance Functor LTree where
|
||||
fmap f (LBranches ts) = LBranches $ (fmap (fmap f)) ts
|
||||
fmap f (LLeaf x) = LLeaf (f x)
|
||||
|
||||
|
||||
flat2 (x,y) = [x,y]
|
||||
flat3 (x,y,z) = [x,y,z]
|
||||
flat4 (x,y,z,w) = [x,y,z,w]
|
||||
|
||||
Reference in New Issue
Block a user