[Haskell-cafe] Question about typeclass & constraints
jean-christophe mincke
jeanchristophe.mincke at gmail.com
Tue Apr 8 08:17:50 UTC 2014
Tom,
Yes of course it is simplified for clarity.
Here is a modified version where fb does something (a bit more usefull)
class PP m where
create :: a -> m a
data A a = A a
instance PP A where
create a = A a
class CB a where
fb :: a -> a
data B m a = B (m a)
instance (PP m) => PP (B m) where
create a = let a' = fb a
in B (create a')
class PP' m a where
create' :: a -> m a
instance (PP m) => PP' m a where
create' = create
instance (PP m, CB a) => PP' (B m) a where
create' a = let a' = fb a
in B (create a')
Actually I ran into that problem when trying to add a kind of rule engine
layer above the Persistent typeclass. Given the complexity of these
typeclass, I think it is more practical to reason about a simpler form of
the same problem.
Thanks
J-C
On Tue, Apr 8, 2014 at 9:42 AM, Tom Ellis <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> On Tue, Apr 08, 2014 at 09:25:17AM +0200, jean-christophe mincke wrote:
> > instance (PP m) => PP (B m) where
> > create a = let _ = fb a
> > in B (create a)
>
> Your use of 'fb' here is baffling. Am I right in thinking you have tried
> to
> simplify your problem for clarity? If so I think you have simplified too
> far!
>
> Could you give an example where the use of 'fb' actually matters?
>
> Tom
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140408/c0c297dd/attachment.html>
More information about the Haskell-Cafe
mailing list