Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Ambiguous type error: multiparam class + type alias (Baa)


----------------------------------------------------------------------

Message: 1
Date: Thu, 28 Sep 2017 16:30:19 +0300
From: Baa <aqua...@gmail.com>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] Ambiguous type error: multiparam
        class + type alias
Message-ID: <20170928163019.00d48434@Pavel>
Content-Type: text/plain; charset=UTF-8

> You could also avoid all this ambiguity/type application stuff with:
> data AsTitle = AsTitle
> class Repr a b where
>    repr :: a -> b -> Repr b
> instance Repr Int AsTitle where
>    repr n _ = ...
> ...
> print (repr n AsTitle)

Yes, "moving" of type from the right-side (result) to the left-side
(arguments) solves the problem, sure.

> (Repr b can be an associated type if you want to support different 
> representations)
> 
> >  
> >> You only add a constraint as follows:
> >> repr n :: forall b. (Repr b ~ Repr AsTitle, ReprC Int b) => Repr
> >> b  
> > Yes... So, `b` is unbound/free type param. But I can bind it with
> > func. deps, yes?  
> How? If you you bind it with a functional dependency on "a", you can 
> only have a single "b" for each "a".

I don't know... I wrote to David my idea - additional param on the
left-side of func. dependency, but how/what param?


===
Best regards, Paul


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 111, Issue 21
******************************************

Reply via email to