Merge pull request #107 from eborden/infix-constructor-pattern-match
Fix infix constructor pattern matching for normal constructorspull/121/head
commit
43e79bb174
|
@ -349,11 +349,14 @@ func reallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongvariable
|
||||||
func (A a) = a
|
func (A a) = a
|
||||||
|
|
||||||
#test list constructor
|
#test list constructor
|
||||||
func (x:xr) = x
|
func (x : xr) = x
|
||||||
|
|
||||||
#test some other constructor symbol
|
#test some other constructor symbol
|
||||||
#pending
|
#pending
|
||||||
func (x:+:xr) = x
|
func (x :+: xr) = x
|
||||||
|
|
||||||
|
#test normal infix constructor
|
||||||
|
func (x `Foo` xr) = x
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -123,8 +123,8 @@ func = do
|
||||||
#test list comprehension comment placement
|
#test list comprehension comment placement
|
||||||
func =
|
func =
|
||||||
[ (thing, take 10 alts) --TODO: select best ones
|
[ (thing, take 10 alts) --TODO: select best ones
|
||||||
| (thing, _got, alts@(_:_)) <- nosuchFooThing
|
| (thing, _got, alts@(_ : _)) <- nosuchFooThing
|
||||||
, gast <- award
|
, gast <- award
|
||||||
]
|
]
|
||||||
|
|
||||||
#test if-then-else comment placement
|
#test if-then-else comment placement
|
||||||
|
|
|
@ -366,11 +366,11 @@ func reallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongvariable
|
||||||
func (A a) = a
|
func (A a) = a
|
||||||
|
|
||||||
#test list constructor
|
#test list constructor
|
||||||
func (x:xr) = x
|
func (x : xr) = x
|
||||||
|
|
||||||
#test some other constructor symbol
|
#test some other constructor symbol
|
||||||
#pending
|
#pending
|
||||||
func (x:+:xr) = x
|
func (x :+: xr) = x
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -748,7 +748,7 @@ func = do
|
||||||
#test list comprehension comment placement
|
#test list comprehension comment placement
|
||||||
func =
|
func =
|
||||||
[ (thing, take 10 alts) --TODO: select best ones
|
[ (thing, take 10 alts) --TODO: select best ones
|
||||||
| (thing, _got, alts@(_:_)) <- nosuchFooThing
|
| (thing, _got, alts@(_ : _)) <- nosuchFooThing
|
||||||
, gast <- award
|
, gast <- award
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,10 @@ layoutPat lpat@(L _ pat) = docWrapNode lpat $ case pat of
|
||||||
return $ x1 Seq.<| xR
|
return $ x1 Seq.<| xR
|
||||||
ConPatIn lname (InfixCon left right) -> do
|
ConPatIn lname (InfixCon left right) -> do
|
||||||
-- a :< b -> expr
|
-- a :< b -> expr
|
||||||
let nameDoc = lrdrNameToText lname
|
nameDoc <- lrdrNameToTextAnn lname
|
||||||
leftDoc <- colsWrapPat =<< layoutPat left
|
leftDoc <- appSep . colsWrapPat =<< layoutPat left
|
||||||
rightDoc <- colsWrapPat =<< layoutPat right
|
rightDoc <- colsWrapPat =<< layoutPat right
|
||||||
middle <- docLit nameDoc
|
middle <- appSep $ docLit nameDoc
|
||||||
return $ Seq.empty Seq.|> leftDoc Seq.|> middle Seq.|> rightDoc
|
return $ Seq.empty Seq.|> leftDoc Seq.|> middle Seq.|> rightDoc
|
||||||
ConPatIn lname (RecCon (HsRecFields [] Nothing)) -> do
|
ConPatIn lname (RecCon (HsRecFields [] Nothing)) -> do
|
||||||
-- Abc{} -> expr
|
-- Abc{} -> expr
|
||||||
|
|
Loading…
Reference in New Issue