Type alias in constraints

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Type alias in constraints

Sylvain Henry-2
Hi,

I have been using constraints of the form:

xxx :: forall x xs ys zs m.
    ( Monad m
    , zs ~ Union (Filter x xs) ys
    , Catchable x xs
    , Liftable (Filter x xs) zs
    , Liftable ys zs
    ) => Variant xs -> (x -> Flow m ys) -> Flow m zs

Where "zs" is used as a type alias. Now with GHC8 and
-Wredundant-constraints, GHC complaints that "zs" is redundant (indeed
it is).

Is there a way to do this properly? If not, could we introduce a new
syntax to make this kind of local declaration? We could borrow the
syntax of local declarations into list-comprehensions: "let zs ~ ..."

Thanks,
Sylvain

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Type alias in constraints

Tom Ellis
On Fri, Oct 14, 2016 at 07:25:40PM +0200, Sylvain Henry wrote:

> I have been using constraints of the form:
>
> xxx :: forall x xs ys zs m.
>    ( Monad m
>    , zs ~ Union (Filter x xs) ys
>    , Catchable x xs
>    , Liftable (Filter x xs) zs
>    , Liftable ys zs
>    ) => Variant xs -> (x -> Flow m ys) -> Flow m zs
>
> Where "zs" is used as a type alias. Now with GHC8 and
> -Wredundant-constraints, GHC complaints that "zs" is redundant
> (indeed it is).

Why is it redundant?  Surely a redundant constraint is one you can freely
remove.  I don't see any constraint you can remove in that type.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Type alias in constraints

Sylvain Henry-2

On 14/10/2016 19:31, Tom Ellis wrote:

> On Fri, Oct 14, 2016 at 07:25:40PM +0200, Sylvain Henry wrote:
>> I have been using constraints of the form:
>>
>> xxx :: forall x xs ys zs m.
>>     ( Monad m
>>     , zs ~ Union (Filter x xs) ys
>>     , Catchable x xs
>>     , Liftable (Filter x xs) zs
>>     , Liftable ys zs
>>     ) => Variant xs -> (x -> Flow m ys) -> Flow m zs
>>
>> Where "zs" is used as a type alias. Now with GHC8 and
>> -Wredundant-constraints, GHC complaints that "zs" is redundant
>> (indeed it is).
> Why is it redundant?  Surely a redundant constraint is one you can freely
> remove.  I don't see any constraint you can remove in that type.

I should have checked on Trac, it has been discussed... today:
https://ghc.haskell.org/trac/ghc/ticket/12700

Also related:
https://ghc.haskell.org/trac/ghc/ticket/12702
https://ghc.haskell.org/trac/ghc/ticket/11474

I will comment there.

Sylvain
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.