Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
EnvT use case
import Data.Tree
import Control.Comonad
import Control.Comonad.Trans.Class
import Control.Comonad.Trans.Env
replusify:: MonadPlus m => [a] -> m a
replusify = msum . map return
class Treeish l where
children :: MonadPlus m => l -> m l
descendants :: MonadPlus m => l -> m l
instance Treeish (Tree a) where
children = replusify . subForest
descendants = replusify . flatten . duplicate
instance Treeish (EnvT e Tree a) where
children = replusify . map rootLabel . subForest . lower . duplicate
descendants = replusify . flatten . lower . duplicate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.