[Haskell-cafe] Understanding GHC's instance inference.

adam vogt vogt.adam at gmail.com
Thu Dec 6 01:00:46 CET 2012


On Wed, Dec 5, 2012 at 12:12 AM, Takayuki Muranushi <muranushi at gmail.com> wrote:
> Dear everyone,
>
> I have a code
> https://github.com/nushio3/practice/blob/master/instance-inference/zipf-11-1.hs
>
> that produces a type-error when I remove a type signature.
> https://github.com/nushio3/practice/blob/master/instance-inference/zipf-11.hs

Hi Takayuki,

The ghc manual sections about the extensions are a good place to
start. Also check out http://okmij.org/ftp/Haskell/

I think you are expecting forZN to be able to use the number of -> in
the function(s) supplied to decide how many lists to take, as done
here: http://paczesiowa.blogspot.ca/2010/03/generalized-zipwithn.html

Replacing the [] container used in the above zipWithN with a
`Data.Key.Zip v => v' that is the same for all of the arguments might
be straightforward. But there are a lot of type signatures that have
to add that parameter, and maybe that will interfere with the
incoherent instance business going on.

Adam



More information about the Haskell-Cafe mailing list