I am doing the 99 Haskell problems: http://www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems
I can name modules something like "Nine.hs" and at the top of that file have
module Nine where
...
but in the interest of brevity I would like to write "9.hs" and have
module 9 where
...
unfortunately this gives me a parse error. Is there a way to do it?
Haskell modules are a useful way to group a set of related functionalities into a single package and manage different functions that may have the same names. The module definition is the first thing that goes in your Haskell file. the name of the module begins with a capital letter; each file contains only one module.
What is an HS file? A file with . hs extension is a Haskell Script file that is written in Haskell, an advanced purely-functional open-source programming language.
From HaskellWiki. Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.
Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)
No, module names may not begin with a digit. You could name it something like P9
, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With