Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Haskell interpreter /w type definitions

Is there a Haskell interpreter that accepts type definitions or preferably all kinds of statements?

I've already tried ghci and hugs and none of these does that. Is there some particular reason that this is hard/impossible?

like image 574
julx Avatar asked Oct 11 '11 09:10

julx


2 Answers

It seems that it will soon be fixed in GHCi, see:

https://ghc.haskell.org/trac/ghc/ticket/4929

like image 89
Ptival Avatar answered Nov 16 '22 05:11

Ptival


Traditionally, the answer to this has been that code written at an interactive prompt lives inside the IO monad. It's as if there's a shadow main = do hiding behind the Prelude>. Think about it that way, and the absence of type declarations and top level declaration syntax makes sense, as do all the let statements.

But Ptival is right: it looks like we won't have to worry about any of that soon.

like image 34
Zopa Avatar answered Nov 16 '22 05:11

Zopa