Sto seguendo un tutorial di haskell: http://www.seas.upenn.edu/~cis194/lectures/01-intro.html
Sto testando le funzioni in ghci, sono arrivato a questa parte:
hailstone :: Integer -> Integer
hailstone n
| n `mod` 2 == 0 = n `div` 2
| otherwise = 3*n + 1
Ho quella funzione in un file .hs, accendo ghci nella stessa directory e vado: l hailstone.hs
l'output è
Syntax error on "mod"
Perhaps you intended to use TemplateHaskell
In the Template Haskell quotation "mod"
Failed, modules loaded: none.
ha cercato su Google e ha provato a caricare questo "templatehaskell" e ha appena finito con un diverso set di errori (http://brandon.si/code/working-with-template-haskell-in-ghci/)
risposte:
7 per risposta № 1Come user2407038 suggerito correttamente nei commenti, il problema era che stavo usando gli apostrofi ("
) rispetto ai backtick (`
), il backtick non è lo stesso della singola citazione che avrei dovuto usare.