[Haskell-cafe] Selda: confused about type signtures

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Apr 23 12:16:50 UTC 2018


On Mon, Apr 23, 2018 at 09:23:58AM +0200, Marc Busqué wrote:
> On Sun, 22 Apr 2018, Tom Ellis wrote:
> >Unless I am much mistaken `Cols s a` is just `a`[1,2].  That explains why
> >the type is ambiguous.  There's nothing that fixes `s`.
> 
> I also thought that, but if I substitute `Cols s a` by `a`, then the
> compilation error is:

I had an error in what I said and also it was imprecise.  It's
`Res (Cols s a)` which is `a`, but only in the cases where you're actually
going to use it, and the compiler cannot take that into account when
solving the constraint.  Anyway, as Li-yao Xia points out in a sibling
message, the type variable `s` in not constrained and therefore it seems
impossible to solve.

> Also, notice that the inferred type does differentiate between `Cols s a` and `a`.
> 
> >Can you show us a minimal example of `list` working?  I'm quite confused
> >about how it could work.
[...]

Thanks, but could you send a full working version that includes a definition
of `list`?  I can't replicate what you've done on my end.

Tom



More information about the Haskell-Cafe mailing list