Why can't I determine the type in GHCi?

Why can't I determine the type in GHCi?

Prelude> data MyBool = T | F

<interactive>:1:0: parse error on input `data'
+3
source share
1 answer

GHCi is a very simple REPL that reads expressions and displays results (usually) and can be represented as an interactive expression do. The problem with providing general Haskell constructs is the following: (a) how to combine them into an already loaded program, (b) what to do with them when you restart or another action that resets the REPL state. In addition, there are questions about what to do when a definition conflicts with something already defined. And then there is the simple fact that the current implementation is simply an evaluator of expressions, while compiling new code is more involved.

+5
source

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


All Articles