Dear Professor:
My name is Carlos Alexandre Grimaldi. I'm engineering student at
Federal University of Rio de Janeiro, Brazil. I began my studies in
Haskell, and I have some doubts which I report here.
I'm very gratefully if you could help me.
I'm following a book I downloaded from Internet: "A Gentle Introduction to
Haskell, Version 98". Following this, I face some problems:
- "inc :: Integer -> Integer" don't work
- "inc n = n+1" don't work too;
- "data Bool = False | True" also...;
- "data Color = Red | Green | Blue | Indigo | Violet" also fails.
I thought that this commands and definitions must be inside a program, and
don't at prompt "prelude>". So, I opened other book, also downloaded
from Internet: "The Hugs 98 User Manual", and I tryed:
"module Fact where
fact :: Integer -> Integer
fact n = product [1..n]"
thinking that would be created a file "Fact", in which the definitions for
"fact" would work. But this also yield an error... So, I ask
you:
- is necessary the creation of a file where that definitions could
work?
- is this file a ".hs"?
- how can I create a file like this? Which command or editor?
- or, if I wrong, why that examples don't work?
Thank you very much for your help.
Best regards,
Carlos A. Grimaldi.