If a newbie considers this as something natural, this is another reason for
syntactic sugaring of HList:

http://www.haskell.org/pipermail/haskell-cafe/2011-April/090986.html

2011/10/2 Du Xi <[email protected]>

> --I tried to write such polymorphic function:
>
> expand (x,y,z) = (x,y,z)
> expand (x,y) = (x,y,1)
>
> --And it didn't compile. Then I added a type signature:
>
> expand::a->b
> expand (x,y,z) = (x,y,z)
> expand (x,y) = (x,y,1)
>
> --It still didn't compile. I think the reason is that the following is
> disallowed:
>
> f::a->b
> f x = x
>
> --Is it possible to get around this and write the "expand" function? Of
> course, x and y may be of different types
>
>
>
> ______________________________**_________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to