augustss/MicroHs

Infix operators don't work

Closed this issue · 4 comments

This works:

module Infix where                                                                    
                                                                                    
(!) :: [a] -> () -> a                                                               
(!) m k = head m

But this doesn't:

module Infix where

(!) :: [a] -> () -> a
m ! k = head m

The error is:

mhs: error: "Infix.hs": line 4, col 14: Cannot satisfy constraint: ([] ~ (_a23 ->))

It works with ghc-9.6 -c Infix.hs.

MicroHs version is:

$ mhs --version
MicroHs, version 0.10.2.0, combinator file version v7.0

~/MicroHs $ git rev-parse HEAD       
efdc17331aba84555fe9931748138aced8a45a63

Is this just !, or any operator?

Ah, right. It's just !. So it might be a clash with the Prelude, I suppose. Seems like GHC 9.6 doesn't have this function in the Prelude somehow.

The problem is that ! needs special hacks since it's also used for BangPatterns. I'll see if I can fix it.

Fixed.
Note that

x ! y = ...

and

x !y = ...

do very different things. Haskell lexing is messy. :)