augustss / MicroHs

Haskell implemented with combinators
Other
354 stars 22 forks source link

Can't compile parsec-2.1.0.1 #43

Closed ysangkok closed 4 months ago

ysangkok commented 4 months ago

Unsure what's going on here, so I thought I'd report it just in case. Apologies if this is somehow a GHC-ism. I am trying to compile an old version of parsec, one that doesn't need mtl.

$ cabal get parsec-2.1.0.1
$ cd parsec-2.1.0.1
$ mhs Text.ParserCombinators.Parsec.Error
mhs: "./Text/ParserCombinators/Parsec/Error.hs": line 162, col 45: Cannot satisfy constraint: (HasField "null" (Bool -> Bool) ([Char] -> Bool))
CallStack (from HasCallStack):
  error, called at src/MicroHs/Expr.hs:542:24 in MicroHs-0.9.10.0-e-mhs-6e71179c8eb4b60198f11a95498fc388cebaabd20be20739e5f2d4e4806ae1cf:MicroHs.Expr
  errorMessage, called at src/MicroHs/TCMonad.hs:30:11 in MicroHs-0.9.10.0-e-mhs-6e71179c8eb4b60198f11a95498fc388cebaabd20be20739e5f2d4e4806ae1cf:MicroHs.TCMonad
  tcError, called at src/MicroHs/TypeCheck.hs:2755:7 in MicroHs-0.9.10.0-e-mhs-6e71179c8eb4b60198f11a95498fc388cebaabd20be20739e5f2d4e4806ae1cf:MicroHs.TypeCheck
  checkConstraints, called at src/MicroHs/TypeCheck.hs:1363:7 in MicroHs-0.9.10.0-e-mhs-6e71179c8eb4b60198f11a95498fc388cebaabd20be20739e5f2d4e4806ae1cf:MicroHs.TypeCheck
  tcDefValue, called at src/MicroHs/TypeCheck.hs:1251:39 in MicroHs-0.9.10.0-e-mhs-6e71179c8eb4b60198f11a95498fc388cebaabd20be20739e5f2d4e4806ae1cf:MicroHs.TypeCheck

The module compiles even using a modern GHC.

ysangkok commented 4 months ago

Oh, the HasField should have tipped me off. MicroHs has OverloadedRecordDot on, which means you can't write not.null. Putting spaces in there fixes the issue.

augustss commented 4 months ago

It's a very annoying problem. Maybe RecordDot should not be always on.