MicroHs icon indicating copy to clipboard operation
MicroHs copied to clipboard

bidirectional pattern synonyms problem

Open claudeha opened this issue 7 months ago • 2 comments

ghc 9.6.6 -XPatternSynonyms accepts

newtype WindowsString = WindowsString{ getWindowsString :: String }

pattern WS :: String -> WindowsString
pattern WS { unWS } <- WindowsString unWS where
  WS a = WindowsString a
{-# COMPLETE WS #-}

main = return ()

mhs 0.14.17.0 rejects

mhs: uncaught exception: error: "bidirectional-pattern-synonym.hs": line 4, col 12:
  found:    {
  expected: LIdent ( = <- , :: ∷

based on real code in os-string package

claudeha avatar Sep 25 '25 16:09 claudeha

That's right. MicroHs does not implement record pattern synonyms. I will take a look to see if it looks easy.

augustss avatar Sep 26 '25 00:09 augustss

Record pattern synonyms is not easy to implement in MicroHs. I'll tag this as an enhancement.

augustss avatar Sep 28 '25 23:09 augustss