[Haskell-beginners] Type variables

Lawrence Bottorff borgauf at gmail.com
Fri Jan 1 05:04:19 UTC 2021


I put this into ghci

makeTriple :: a -> b -> c -> (a,b,c)
makeTriple x y z = (x,y,z)

then as expected

> :t makeTriple
: makeTriple :: a -> b -> c -> (a, b, c)

but then on a whim I try this

> :t (makeTriple 123 "Hi" 234.0)
 (makeTriple 123 "Hi" 234.0)
   :: (Fractional c, Num a) => (a, [Char], c)

I retry

> :t (123,"Hi",234.0)
(123,"Hi",234.0) :: (Fractional c, Num a) => (a, [Char], c)

What is this telling me? I'm not experienced enough to decode this.

LB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20201231/e27bffc3/attachment.html>


More information about the Beginners mailing list