Why can't I define a new type in ghci?

前端 未结 4 1172
花落未央
花落未央 2020-12-30 19:34

I get an error in ghci when I try to define a new type:

Prelude> data Point = Pt Int Int
:1:0: parse error on input `data\'
Prelude> let d         


        
4条回答
  •  旧时难觅i
    2020-12-30 20:17

    Just for historical reference, the HBI Haskell interactive environment allows for full Haskell at the command line, including types, classes and so on. There's no a priori GHCi can't operate similarly, and users could write a front-end to GHC-API that supported this...

提交回复
热议问题