[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] newtype a Constraint?
From:       Gábor_Lehel <illissius () gmail ! com>
Date:       2013-03-12 13:26:38
Message-ID: CAPNUp0-mKggVTyGPO8NfNp+Gtbxd7WfcUqhrRxPma4aSJy6-xg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


{-# LANGUAGE UndecidableInstances #-}

class OldConstraint a => NewtypedConstraint a
instance OldConstraint a => NewtypedConstraint a

perhaps?

Nice thing is you don't even need to do wrapping/unwrapping, like you do
with data newtypes.


On Tue, Mar 12, 2013 at 2:18 PM, Roman Cheplyaka <roma@ro-che.info> wrote:

> Is there a way to newtype a constraint?
>
> Imagine a type class parameterised over constraints. What do I do if I
> want multiple instances for (essentially) the same constraint?
>
> Roman
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Your ship was destroyed in a monadic eruption.

[Attachment #5 (text/html)]

<div dir="ltr"><div>{-# LANGUAGE UndecidableInstances \
#-}</div><div><br></div><div>class OldConstraint a =&gt; NewtypedConstraint \
a<br></div><div>instance OldConstraint a =&gt; NewtypedConstraint \
a</div><div><br></div><div> perhaps?</div><div><br></div><div>Nice thing is you \
don&#39;t even need to do wrapping/unwrapping, like you do with data \
newtypes.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On \
Tue, Mar 12, 2013 at 2:18 PM, Roman Cheplyaka <span dir="ltr">&lt;<a \
href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>&gt;</span> \
wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex">Is there a way to newtype a constraint?<br> <br>
Imagine a type class parameterised over constraints. What do I do if I<br>
want multiple instances for (essentially) the same constraint?<br>
<br>
Roman<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" \
target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br> \
</blockquote></div><br><br clear="all"><br>-- <br>Your ship was destroyed in a \
monadic eruption. </div>



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic