{-# Language PatternSynonyms #-}
{-# Language ViewPatterns #-}
data DMonad m = DMonad
(forall a. a -> m a)
(forall a b. m a -> (a -> m b) -> m b)
(forall a. String -> m a)
pattern Open :: (forall a. a -> [a]) -> (forall a a'. [a] -> (a -> [a']) -> [a']) -> (forall a. String -> [a]) -> xxx
pattern Open { return, bind, fail } <- (const $ DMonad (pure @[]) (P.>>=) Control.Monad.fail -> DMonad return bind fail)
bar :: [a] -> [a]
bar a@Open{..} = do
a' <- a
return a'
Last active
August 7, 2017 09:09
-
-
Save Icelandjack/0f94cbca3f5c5842f98ba2e7e9d07d49 to your computer and use it in GitHub Desktop.
Open Monad dictionary with record pattern synonym (and as patterns)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I modified this to:
And got the following compiler panic:
(which I think is because of the
pure
name-clash: qualifying everything fixed the bug.)