{-# 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'
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.)