[Haskell-beginners] Question on syntax

Rohit Sharma rohits79 at gmail.com
Sat Oct 25 03:31:01 UTC 2014


All,

I started learning haskell very recently and have a question on the pattern
matching style for lists.

In the below snippet i.e. "(x:xs)" why do we went with round braces and not
square? I know we are using cons that tells this is not a tuple but would
it not make more sense to write something like [x:xs] instead of (x:xs), i
thought round braces was used for pair/tuples?

safeHead [] = Nothing
safeHead (x:xs) = Just x

Thanks,
Rohit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141025/00248e82/attachment.html>


More information about the Beginners mailing list