Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming of Haskell Modules

Tags:

haskell

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?

like image 768
nebffa Avatar asked Apr 29 '13 06:04

nebffa


People also ask

How do you define a module in Haskell?

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 are Haskell files called?

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.

What does prelude mean in Haskell?

From HaskellWiki. Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.

How do I load a Haskell file?

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.)


1 Answers

No, module names may not begin with a digit. You could name it something like P9, though.

like image 84
hammar Avatar answered Nov 28 '22 14:11

hammar