optional arguments in haskell
Posted
by snorlaks
on Stack Overflow
See other posts from Stack Overflow
or by snorlaks
Published on 2010-05-07T18:39:13Z
Indexed on
2010/05/07
18:48 UTC
Read the original article
Hit count: 390
Hello,
I have declared my own type:
data Book = Bookinfo { bookId :: Int, title :: String } deriving(Show)
and now:
x = Bookinfo
it is all ok, valid statement
but making bookId x throws an error.
If I would be able to handle errors in Haskell that would be ok but right now I cant do this So Im curious how to make not specified values of fields take default value, and what exactly value is there when I'm not giving vcalues of fields in construcotr ?
thanks for help
© Stack Overflow or respective owner