on master help sign in
Treat strings like any other pattern literal
commit958fb1c89608ca7af20a459c09084b2147273154 authorEvan Czaplicki <info@elm-lang.org> dateWed 2 Oct 2013, 16:55 (13 years ago) parentdce5e3e
1 file changed+1−5
compiler/Parse/Pattern.hs+1−5
compiler/Parse/Pattern.hs+1−5
@@ -23,11 +23,7 @@ basic = choice
2323 "True" -> PLiteral (Boolean True)
2424 "False" -> PLiteral (Boolean False)
2525 c : _ -> if isUpper c then PData v [] else PVar v
26− , do lit <- literal
27− return $ case lit of
28− Str s -> foldr combine (PData "[]" []) s
29− where combine h t = PData "::" [PLiteral (Chr h),t]
30− _ -> PLiteral lit
26+ , PLiteral <$> literal
3127 ]
3228
3329asPattern :: Pattern -> IParser Pattern