I am totally newbie to haskell.
I have such snippet code
lucky:: Int->String
lucky 7 = "LUCKY NUMBER SEVEN!"
lucky x = "Sorry , youre out of luck pal!"
I tried to input to terminal directly, seems not right.
But if I want to put this in file and load this file, then call lucky function. How should I construct this file?
Thank you!
I tried this:
module Main where
lucky:: Int->String
lucky 7 = "LUCKY NUMBER SEVEN!"
lucky x = "Sorry , youre out of luck pal!"
main = do
But when i try to call lucky in terminal, i got this:
factorial.hs:7:8: Empty 'do' construct
lucky 7
<interactive>:1:1: Not in scope: `lucky'
No comments:
Post a Comment