[GHC] #13876: Check 'pure' method of 'Applicative (WrappedMonad m)'
GHC
ghc-devs at haskell.org
Tue Jun 27 13:03:59 UTC 2017
#13876: Check 'pure' method of 'Applicative (WrappedMonad m)'
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
To explain: this is not about defining `pure` / `return` differently but
rather defining `pure @V3` in terms of `pure @(WrappedMonad V3)` to make
use of the methods of `Monad` to define the methods of `Applicative`
{{{#!hs
pure @V3 @a
= coerce (pure @(WrappedMonad V3) @a)
= coerce (WrapMonad . pure @V3 @a)
= pure @V3 @a
}}}
With my suggestion this works
{{{#!hs
pure @V3 @a
= coerce (pure @(WrappedMonad V3) @a)
= coerce (WrapMonad . return @V3 @a)
= return @V3 @a
}}}
If MRP goes through then I would need a `newtype` wrapped with a `Pointed`
& `Monad` constraint to define `Applicative`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13876#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list