agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

parse error on addatomfunction #214

Closed YuMingLiao closed 5 years ago

YuMingLiao commented 5 years ago

Hi, @agentm

Just encounter this when I try to learn the use of atom function.

It fails at the first example, but succeeds on the second one.

TutorialD (master/main): addatomfunction "celsiusToFahrenheit" Int -> Either AtomFunctionError Int """(\\((IntAtom c):_) -> pure $ IntAtom ( (c * 9 `div` 5) + 32)) :: [Atom] -> Either AtomFunctionError Atom"""
ERR: parse error on input `->'
TutorialD (master/main): data CelsiusTemperature = CelsiusTemperature Int
TutorialD (master/main): data FahrenheitTemperature = FahrenheitTemperature Int
TutorialD (master/main): addatomfunction "celsiusToFahrenheit" CelsiusTemperature -> Either AtomFunctionError FahrenheitTemperature """(\(ConstructedAtom _ _ (IntAtom celsius:_):_) -> pure $ ConstructedAtom "Fahrenheit" (ConstructedAtomType "Fahrenheit" empty) [IntAtom (celsius * (9 `div` 5) + 32)]) :: [Atom] -> Either AtomFunctionError Atom """
TutorialD (master/main): 
YuMingLiao commented 5 years ago

found it! Just one less \ and the example works. Closed.

agentm commented 5 years ago

Oops, thanks for finding that!