1

I've been sitting around here for quite some time now and my problem just won't solve by googling, try and error. I've got the following code snippet:

data Prozess = Prozess { pid :: Int, arrival :: Int, computing :: Int } deriving (Show)

let idle = Prozess{pid=1, arrival=5, computing=10}

So I tried to compile it with ghci, but it's keep giving me a "parse error (possibly incorrect indentation or mismatched brackets)" at the "let idle ..."-line. Weird thing is, I tried compiling this using our Jupyter-Server and that seems to work nicely. Also, if I compile it without the "let"-line and input the -exact- same line afterwards via Terminal in *Main>, it's working fine too.

So what's wrong with ghci? Think I'm losing my mind over this.

CptSnuggles
  • 137
  • 1
  • 3
  • 11
  • Possible duplicate of [GHCi "let" -- what does it do?](http://stackoverflow.com/questions/14052093/ghci-let-what-does-it-do) – Veritas Jun 11 '16 at 15:50

1 Answers1

4

Your let isn't in any function is it?

If you're just defining a global "constant", you just go:

idle :: Prozess
idle = Prozess{pid=1, arrival=5, computing=10}

Also, note that you don't need the record notation. You can swap that for:

idle = Prozess 1 5 10

Arnon
  • 2,237
  • 15
  • 23