Merge pull request #107 from eborden/infix-constructor-pattern-match

Fix infix constructor pattern matching for normal constructors
pull/121/head
Lennart Spitzner 2018-02-13 17:26:32 +01:00
commit 43e79bb174
4 changed files with 13 additions and 10 deletions

View File

@ -355,6 +355,9 @@ func (x:xr) = x
#pending
func (x :+: xr) = x
#test normal infix constructor
func (x `Foo` xr) = x
###############################################################################
###############################################################################

View File

@ -77,10 +77,10 @@ layoutPat lpat@(L _ pat) = docWrapNode lpat $ case pat of
return $ x1 Seq.<| xR
ConPatIn lname (InfixCon left right) -> do
-- a :< b -> expr
let nameDoc = lrdrNameToText lname
leftDoc <- colsWrapPat =<< layoutPat left
nameDoc <- lrdrNameToTextAnn lname
leftDoc <- appSep . colsWrapPat =<< layoutPat left
rightDoc <- colsWrapPat =<< layoutPat right
middle <- docLit nameDoc
middle <- appSep $ docLit nameDoc
return $ Seq.empty Seq.|> leftDoc Seq.|> middle Seq.|> rightDoc
ConPatIn lname (RecCon (HsRecFields [] Nothing)) -> do
-- Abc{} -> expr