RE: forall in constraint

2017-10-23 Thread Simon Peyton Jones via ghc-devs
Sorry to be slow Simon From: Alan & Kim Zimmerman [mailto:alan.z...@gmail.com] Sent: 23 October 2017 22:36 To: Simon Peyton Jones <simo...@microsoft.com> Cc: ghc-devs@haskell.org Subject: Re: forall in constraint In Shayan's implementation he has [1] data ImplicitBndrs x thing = IB

Re: forall in constraint

2017-10-23 Thread Alan & Kim Zimmerman
In Shayan's implementation he has [1] data ImplicitBndrs x thing = IB (XIB x thing) thing | NewImplicitBndrs (XNewImplicitBndrs x thing) type family XIB x thing type family XNewImplicitBndrs x thing type ForallXImplicitBndrs c x thing = ( c (XIB

RE: forall in constraint

2017-10-23 Thread Simon Peyton Jones via ghc-devs
I’m lost. Could you give me a bit more context? I’m deeply suspicious about that ForallXImplicitBndrs thing with strange higher kinded parameters. Smells all wrong to me. Simon From: ghc-devs [mailto:ghc-devs-boun...@haskell.org] On Behalf Of Alan & Kim Zimmerman Sent: 23 October 2017 16:07

Re: forall in constraint

2017-10-23 Thread Li-yao Xia
Hi Alan, One way is to define a new typeclass. type ImplicitBndrs c x thing = (c (XIB x thing), c (XNewImplicitBndrs x thing)) class ForallImplicitBndrs c x where withImplicitBndrs :: forall thing. (ImplicitBndrs c x thing => t) -> t Although that requires you to write one instance