I'm finding a very strange behavior for some Haskell code I'm working on. I'm working in a .hs file and the following simple function compiles in GHCi just fine:
func mat l =
if mat == [1,0,0,0] then l
else
let trymat t = if t == 0 then trymat 1 else if t == 4 then error "Not ok!" else l
in l
When I add a single newline, i.e.
func mat l =
if mat == [1,0,0,0] then l
else
let trymat t =
if t == 0 then trymat 1 else if t == 4 then error "Not ok!" else l
in l
the compiler gets angry:
λ> :load code.hs
parse error (possibly incorrect indentation or mismatched brackets)
|
67 | if t == 0 then trymat 1 else if t == 4 then error "Not ok!" else l
| ^
This seems to happen no matter how I space out / parenthesize the inner if block, and also happens with cases. It's extra weird because trymat is a total dummy function: it's never even called again! Any clue why this is happening, and how I'll be able to add function definitions and cases and such in my code going forward? Thanks!
trymatfunction, but you are not using it.