I stumbled upon a problem which I reduced to this minimal testcase. So, basically, for some reason, if I pattern-match a string with a variable, the pattern-match succeeds even though it shouldn’t.
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
main :: Effect Unit
main = do
let foo = "foo"
log $ case "bar" of
foo -> "incorrect match"
_ -> "matched correctly"
Here, I match "foo" against "bar". So you’d expect match should fail, right? But it doesn’t! Instead it takes the branch “incorrect match”, i.e. it thinks “foo” is equal to “bar”.
Is this expected behavior, do I miss something?