-show4 :: Integral i => i -> String
-show4 i
- | i >= 0 && i < 10 = "000" ++ show i
- | i >= 0 && i < 100 = "00" ++ show i
- | i >= 0 && i < 1000 = "0" ++ show i
- | i >= 0 && i < 10000 = show i
- | otherwise = error ("show4: the integer i must satisfy 0 <= i < 10000: " ++ show i)
-
-show2 :: Integral i => i -> String
-show2 i
- | i >= 0 && i < 10 = "0" ++ show i
- | i >= 0 && i < 100 = show i
- | otherwise = error ("show2: the integer i must satisfy 0 <= i < 100: " ++ show i)
-
-read4 :: (Stream s m Char, Num n) => ParsecT s u m n
-read4 = do n1 <- digit'
- n2 <- digit'
- n3 <- digit'
- n4 <- digit'
+longMonthName ∷ Num n ⇒ n → String
+{-# INLINEABLE longMonthName #-}
+longMonthName 1 = "January"
+longMonthName 2 = "February"
+longMonthName 3 = "March"
+longMonthName 4 = "April"
+longMonthName 5 = "May"
+longMonthName 6 = "June"
+longMonthName 7 = "July"
+longMonthName 8 = "August"
+longMonthName 9 = "September"
+longMonthName 10 = "October"
+longMonthName 11 = "November"
+longMonthName 12 = "December"
+longMonthName n = error ("longMonthName: invalid month: " ⧺ show n)
+
+longMonthNameP ∷ Num n ⇒ Parser n
+{-# INLINEABLE longMonthNameP #-}
+longMonthNameP
+ = choice [ char 'J'
+ *> choice [ string "anuary" *> return 1
+ , char 'u'
+ *> choice [ string "ne" *> return 6
+ , string "ly" *> return 7
+ ]
+ ]
+ , string "February" *> return 2
+ , string "Ma"
+ *> choice [ string "rch" *> return 3
+ , char 'y' *> return 5
+ ]
+ , char 'A'
+ *> choice [ string "pril" *> return 4
+ , string "ugust" *> return 8
+ ]
+ , string "September" *> return 9
+ , string "October" *> return 10
+ , string "November" *> return 11
+ , string "December" *> return 12
+ ]
+
+show4 ∷ Integral i ⇒ i → AsciiBuilder
+{-# INLINE show4 #-}
+show4 = A.unsafeFromBuilder ∘ go
+ where
+ {-# INLINEABLE go #-}
+ go i | i ≥ 0 ∧ i < 10 = B.fromByteString "000" ⊕ BT.digit i
+ | i ≥ 0 ∧ i < 100 = B.fromByteString "00" ⊕ BT.integral i
+ | i ≥ 0 ∧ i < 1000 = B.fromByteString "0" ⊕ BT.integral i
+ | i ≥ 0 ∧ i < 10000 = BT.integral i
+ | otherwise = error ("show4: the integer i must satisfy 0 <= i < 10000: " ⧺ show i)
+
+show2 ∷ Integral i ⇒ i → AsciiBuilder
+{-# INLINE show2 #-}
+show2 = A.unsafeFromBuilder ∘ go
+ where
+ go i | i ≥ 0 ∧ i < 10 = B.fromByteString "0" ⊕ BT.digit i
+ | i ≥ 0 ∧ i < 100 = BT.integral i
+ | otherwise = error ("show2: the integer i must satisfy 0 <= i < 100: " ⧺ show i)
+
+read4 ∷ Num n ⇒ Parser n
+{-# INLINEABLE read4 #-}
+read4 = do n1 ← digit'
+ n2 ← digit'
+ n3 ← digit'
+ n4 ← digit'