Skip to content

Commit 1d31e2a

Browse files
committed
Fix the incomplete pattern problem in the tests too
(But no need to leave the compatibility shim here.)
1 parent b510549 commit 1d31e2a

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

tests/default_typeclass.x

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,28 @@ tokens :-
5151
{
5252

5353
-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.
54-
utf8Encode :: Char -> [Word8]
55-
utf8Encode = map fromIntegral . go . ord
54+
utf8Encode' :: Char -> (Word8, [Word8])
55+
utf8Encode' c = (fromIntegral x, map fromIntegral xs)
5656
where
5757
go oc
58-
| oc <= 0x7f = [oc]
58+
| oc <= 0x7f = ( oc
59+
, [
60+
])
5961

60-
| oc <= 0x7ff = [ 0xc0 + (oc `Data.Bits.shiftR` 6)
61-
, 0x80 + oc Data.Bits..&. 0x3f
62-
]
62+
| oc <= 0x7ff = ( 0xc0 + (oc `Data.Bits.shiftR` 6)
63+
, [0x80 + oc Data.Bits..&. 0x3f
64+
])
6365

64-
| oc <= 0xffff = [ 0xe0 + (oc `Data.Bits.shiftR` 12)
65-
, 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)
66+
| oc <= 0xffff = ( 0xe0 + (oc `Data.Bits.shiftR` 12)
67+
, [0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)
6668
, 0x80 + oc Data.Bits..&. 0x3f
67-
]
68-
| otherwise = [ 0xf0 + (oc `Data.Bits.shiftR` 18)
69-
, 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)
69+
])
70+
| otherwise = ( 0xf0 + (oc `Data.Bits.shiftR` 18)
71+
, [0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)
7072
, 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)
7173
, 0x80 + oc Data.Bits..&. 0x3f
72-
]
74+
])
75+
(x, xs) = go (ord c)
7376

7477
type Byte = Word8
7578

@@ -99,7 +102,7 @@ alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)
99102
alexGetByte (p,c,(b:bs),s) = Just (b,(p,c,bs,s))
100103
alexGetByte (_,_,[],[]) = Nothing
101104
alexGetByte (p,_,[],(c:s)) = let p' = alexMove p c
102-
(b:bs) = utf8Encode c
105+
(b, bs) = utf8Encode' c
103106
in p' `seq` Just (b, (p', c, bs, s))
104107

105108
data AlexPosn = AlexPn !Int !Int !Int

0 commit comments

Comments
 (0)