Syntax error on 'mod' Haskell

I follow the haskell tutorial: http://www.seas.upenn.edu/~cis194/lectures/01-intro.html

I am testing functions in ghci, I got to this part:

hailstone :: Integer -> Integer
hailstone n
  | n `mod` 2 == 0 = n `div` 2
  | otherwise      = 3*n + 1

I have this function in the .hs file, I run ghci in the same directory and go: l hailstone.hs

conclusion

Syntax error on 'mod'
    Perhaps you intended to use TemplateHaskell
    In the Template Haskell quotation 'mod'
Failed, modules loaded: none.

did some google search and tried to load this "templatehaskell" and just ended up with a different set of errors ( http://brandon.si/code/working-with-template-haskell-in-ghci/ )

+4
source share
1 answer

user2407038, , , ('), backticks (`), , .

+7

Source: https://habr.com/ru/post/1546941/


All Articles