summaryrefslogtreecommitdiff
path: root/prototypes/LamMachine.hs
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-06-09 17:14:31 +0200
committerPéter Diviánszky <divipp@gmail.com>2016-06-09 17:14:31 +0200
commitd70ef80e63a0f84798071d31abbf80747c1fe639 (patch)
tree54f3d5dc021ad2e61a553fe711b17352d3f72a81 /prototypes/LamMachine.hs
parent57fd497f487b83d6eab1e2ca05e6ff5722af6938 (diff)
use splay lists
Diffstat (limited to 'prototypes/LamMachine.hs')
-rw-r--r--prototypes/LamMachine.hs268
1 files changed, 107 insertions, 161 deletions
diff --git a/prototypes/LamMachine.hs b/prototypes/LamMachine.hs
index d878bcb4..f5375d7f 100644
--- a/prototypes/LamMachine.hs
+++ b/prototypes/LamMachine.hs
@@ -7,7 +7,10 @@
7{-# LANGUAGE TypeSynonymInstances #-} 7{-# LANGUAGE TypeSynonymInstances #-}
8{-# LANGUAGE FlexibleInstances #-} 8{-# LANGUAGE FlexibleInstances #-}
9{-# LANGUAGE GeneralizedNewtypeDeriving #-} 9{-# LANGUAGE GeneralizedNewtypeDeriving #-}
10{-# LANGUAGE MultiParamTypeClasses #-}
11{-# LANGUAGE FlexibleContexts #-}
10{-# LANGUAGE NoMonomorphismRestriction #-} 12{-# LANGUAGE NoMonomorphismRestriction #-}
13{-# LANGUAGE TypeFamilies #-}
11 14
12module LamMachine where 15module LamMachine where
13 16
@@ -16,6 +19,8 @@ import Data.Word
16import Data.Int 19import Data.Int
17import Data.Monoid 20import Data.Monoid
18import Data.Maybe 21import Data.Maybe
22--import Data.Foldable (toList)
23import qualified SplayList as F
19import Control.Arrow hiding ((<+>)) 24import Control.Arrow hiding ((<+>))
20import Control.Category hiding ((.), id) 25import Control.Category hiding ((.), id)
21import Control.Monad 26import Control.Monad
@@ -28,20 +33,20 @@ import FreeVars
28--------------------------------------------------------------------- data structures 33--------------------------------------------------------------------- data structures
29 34
30data Lit 35data Lit
31 = LInt !Int 36 = LInt !Int
32 | LChar !Char 37 | LChar !Char
33 | LFloat !Double 38 | LFloat !Double
34 deriving Eq 39 deriving Eq
35 40
36data Exp_ 41data Exp
37 = Var_ 42 = Var_ !VarFV
38 | Lam_ VarInfo !Exp 43 | Lam_ VarInfo !(FVCache FV (LamFV Exp))
39 | Let_ VarInfo !Exp !Exp 44 | Let_ VarInfo !(FVCache FV (Exp, LamFV Exp))
40 | Con_ ConInfo !Int [Exp] 45 | Con_ ConInfo !Int (FVCache FV [Exp])
41 | Case_ CaseInfo !Exp ![Exp] 46 | Case_ CaseInfo !(FVCache FV (Exp, [Exp]))
42 | Lit_ !Lit 47 | Lit !Lit
43 | Op1_ !Op1 !Exp 48 | Op1 !Op1 !Exp
44 | Op2_ !Op2 !Exp !Exp 49 | Op2_ !Op2 !(FVCache FV (Exp, Exp))
45 deriving (Eq, Show) 50 deriving (Eq, Show)
46 51
47data Op1 = HNFMark | YOp | Round 52data Op1 = HNFMark | YOp | Round
@@ -55,29 +60,54 @@ pattern App a b = Op2 AppOp a b
55pattern Seq a b = Op2 SeqOp a b 60pattern Seq a b = Op2 SeqOp a b
56pattern Int i = Lit (LInt i) 61pattern Int i = Lit (LInt i)
57 62
58infixl 4 `App` 63pattern Var i = Var_ (VarFV i)
64pattern Lam n i = Lam_ n (CacheFV (LamFV i))
65pattern Let n i x <- Let_ n (CacheFV (i, LamFV x))
66 where Let _ _ (down 0 -> Just x) = x
67 Let n i x = Let_ n (CacheFV (i, LamFV x))
68pattern Con a b i = Con_ a b (CacheFV i)
69pattern Case a b c = Case_ a (CacheFV (b, c))
70pattern Op2 op a b = Op2_ op (CacheFV (a, b))
59 71
60-- cached and compressed free variables set 72infixl 4 `App`
61data Exp = Exp !FV !Exp_
62 deriving (Eq, Show)
63 73
64data EnvPiece 74data EnvPiece
65 = ELet VarInfo !Exp 75 = ELet_ VarInfo !Exp
66 | EDLet1 VarInfo !DExp 76 | EDLet1_ VarInfo !(LamFV DExp)
67 | ECase_ CaseInfo !FV ![Exp] 77 | ECase_ CaseInfo !(FVCache FV [Exp])
68 | EOp2_1 !Op2 !Exp 78 | EOp2_1_ !Op2 !Exp
69 | EOp2_2 !Op2 !Exp 79 | EOp2_2_ !Op2 !Exp
70 deriving (Eq, Show) 80 deriving (Eq, Show)
71 81
72data DExp 82pattern ELet i x = ELet_ i x
73 = DExpNil -- variable 83pattern EDLet1 i x = EDLet1_ i (LamFV x)
74 | DExpCons_ !FV !EnvPiece !DExp 84pattern ECase op b = ECase_ op (CacheFV b)
75 deriving (Eq, Show) 85pattern EOp2_1 i x = EOp2_1_ i x
86pattern EOp2_2 i x = EOp2_2_ i x
76 87
77data DEnv 88type DEnv = F.SplayList EnvPiece
78 = DEnvNil 89
79 | DEnvCons !EnvPiece !DEnv 90pattern DEnvNil = F.Nil
80 deriving (Eq, Show) 91
92pattern DEnvCons :: EnvPiece -> DEnv -> DEnv
93pattern DEnvCons p e = F.Cons p e
94
95instance F.Measured EnvPiece where
96 type Measure EnvPiece = Nat
97 measure = \case
98 ELet_{} -> 1
99 _ -> 0
100--instance HasSFV DExp where
101
102
103type DExp = DEnv
104
105pattern DExpNil = DEnvNil
106
107pattern DExpCons :: EnvPiece -> DExp -> DExp
108pattern DExpCons p e = F.Snoc e p
109
110infixr 4 `DEnvCons`, `DExpCons`
81 111
82-- state of the machine 112-- state of the machine
83data MSt = MSt !DEnv !Exp 113data MSt = MSt !DEnv !Exp
@@ -89,122 +119,40 @@ type VarInfo = String
89type ConInfo = String 119type ConInfo = String
90type CaseInfo = [(String, [String])] 120type CaseInfo = [(String, [String])]
91 121
92--------------------------------------------------------------------- pattern synonyms 122--------------------------------------------------------------------- instances
93 123
94infixr 4 `DEnvCons`, `DExpCons` 124instance HasFV Exp where
125 fvLens = \case
126 Op1 op e -> appLens (Op1 op) e
127 Op2_ op e -> appLens (Op2_ op) e
128 Con_ x op e -> appLens (Con_ x op) e
129 Case_ op e -> appLens (Case_ op) e
130 Let_ op e -> appLens (Let_ op) e
131 Lam_ op e -> appLens (Lam_ op) e
132 Var_ e -> appLens Var_ e
133 Lit l -> lConst $ Lit l
134
135instance HasFV EnvPiece where
136 fvLens = \case
137 EOp2_1_ op e -> appLens (EOp2_1_ op) e
138 EOp2_2_ op e -> appLens (EOp2_2_ op) e
139 ECase_ op e -> appLens (ECase_ op) e
140 ELet_ op e -> appLens (ELet_ op) e
141 EDLet1_ op e -> appLens (EDLet1_ op) e
95 142
96pattern ECase op e <- ECase_ op u (map (upp u) -> e) 143---------------------------
97 where ECase op b = ECase_ op u bz where (u, bz) = deltas b
98
99pattern EnvPiece sfv p <- (getEnvPiece -> (sfv, p))
100 where EnvPiece sfv@(SFV n u') = \case
101 EOp2_1 op e -> EOp2_1 op (uppS sfv e)
102 EOp2_2 op e -> EOp2_2 op (uppS sfv e)
103 ECase_ s u es -> ECase_ s (expand u' u) es
104 ELet n (Exp u e) -> ELet n (Exp (sDrop 1 u' `expand` u) e)
105 EDLet1 n z -> EDLet1 n $ uppDE u' 1 z
106
107getEnvPiece = \case
108 EOp2_1 op (Exp u e) -> (SFV 0 u, EOp2_1 op (Exp (selfContract u) e))
109 EOp2_2 op (Exp u e) -> (SFV 0 u, EOp2_2 op (Exp (selfContract u) e))
110 ECase_ s u es -> (SFV 0 u, ECase_ s (selfContract u) es)
111 ELet n (Exp u e) -> (SFV 1 $ fv 1 0 u, ELet n $ Exp (selfContract u) e)
112 EDLet1 n DExpNil -> (mempty, EDLet1 n DExpNil)
113 EDLet1 n (DExpCons_ u x y) -> (SFV 0 $ sDrop 1 u, EDLet1 n $ DExpCons_ (onTail selfContract 1 u) x y)
114
115uppS (SFV _ x) (Exp u a) = Exp (expand x u) a
116
117pattern DExpCons :: EnvPiece -> DExp -> DExp
118pattern DExpCons a b <- (getDExpCons -> (a, b))
119 where DExpCons (EnvPiece ux a) DExpNil = DExpCons_ (fromSFV s) (EnvPiece ux' a) DExpNil
120 where (s, D1 ux') = diffT $ D1 ux
121 DExpCons (ELet _ a) (dDown 0 -> Just d) = d
122 DExpCons (EnvPiece ux a) (DExpCons_ u x y) = DExpCons_ (fromSFV s) (EnvPiece ux' a) (DExpCons_ u' x y)
123 where (s, D2 (SFV 0 u') ux') = diffT $ D2 (SFV 0 u) ux
124
125getDExpCons (DExpCons_ u x@(EnvPiece (SFV n _) _) b) = (uppEP u x, uppDE u n b)
126
127uppEP u (EnvPiece (SFV n x) y) = EnvPiece (SFV n $ onTail (u `expand`) n x) y
128
129upP i j = uppEP $ mkUp i j
130
131incFV' (SFV n u) = SFV (n + 1) $ incFV u
132
133uppDE :: FV -> Nat -> DExp -> DExp
134uppDE a _ DExpNil = DExpNil
135uppDE a n (DExpCons_ u x y) = DExpCons_ (onTail (expand a) n u) x y
136
137dDown i DExpNil = Just DExpNil
138dDown i (DExpCons_ u a b) = DExpCons_ <$> downFV i u <*> pure a <*> pure b
139
140---------------------------------------------------------------------
141
142pattern Lit i <- Exp _ (Lit_ i)
143 where Lit i = Exp mempty $ Lit_ i
144pattern Op2 op a b <- Exp u (Op2_ op (upp u -> a) (upp u -> b))
145 where Op2 op a b = Exp s $ Op2_ op az bz where (s, az, bz) = delta2 a b
146pattern Op1 op a <- Exp u (Op1_ op (upp u -> a))
147 where Op1 op (Exp ab x) = Exp ab $ Op1_ op $ Exp (selfContract ab) x
148pattern Var' i = Exp (VarFV i) Var_
149pattern Var i = Var' i
150pattern Lam n i <- Exp u (Lam_ n (upp (incFV u) -> i))
151 where Lam n (Exp vs ax) = Exp (sDrop 1 vs) $ Lam_ n $ Exp (compact vs) ax
152pattern Con a b i <- Exp u (Con_ a b (map (upp u) -> i))
153 where Con a b x = Exp s $ Con_ a b bz where (s, bz) = deltas x
154pattern Case a b c <- Exp u (Case_ a (upp u -> b) (map (upp u) -> c))
155 where Case cn a b = Exp s $ Case_ cn az bz where (s, az: bz) = deltas $ a: b
156
157pattern Let n i x <- Exp u (Let_ n (upp u -> i) (upp (incFV u) -> x))
158 where Let _ _ (down 0 -> Just x) = x
159 Let n a b = Exp s (Let_ n a' b') where (s, a', Lam _ b') = delta2 a $ Lam n b
160 144
161pattern InHNF a <- (getHNF -> Just a) 145pattern InHNF a <- (getHNF -> Just a)
162 where InHNF a@Lit{} = a 146 where InHNF a@Lit{} = a
163 InHNF a@Lam{} = a 147 InHNF a@Lam{} = a
164 InHNF a@(Op1 HNFMark _) = a 148 InHNF a@(Op1 HNFMark _) = a
165 InHNF a = Op1 HNFMark a 149 InHNF a = Op1 HNFMark a
166 150
167getHNF x = case x of 151getHNF x = case x of
168 Lit{} -> Just x 152 Lit{} -> Just x
169 Lam{} -> Just x 153 Lam{} -> Just x
170 Op1 HNFMark a -> Just a 154 Op1 HNFMark a -> Just a
171 _ -> Nothing 155 _ -> Nothing
172
173delta2 (Exp ua a) (Exp ub b) = (s, Exp ua' a, Exp ub' b)
174 where
175 (s, ua', ub') = delta2' ua ub
176
177delta2' ua ub = (s, primContract s ua, primContract s ub)
178 where
179 s = ua <> ub
180
181deltas [] = (mempty, [])
182deltas [Exp x e] = (x, [Exp (selfContract x) e])
183deltas [Exp ua a, Exp ub b] = (s, [Exp (primContract s ua) a, Exp (primContract s ub) b])
184 where
185 s = ua <> ub
186deltas es = (s, [Exp (primContract s u) e | (u, Exp _ e) <- zip xs es])
187 where
188 xs = [ue | Exp ue _ <- es]
189
190 s = mconcat xs
191
192upp :: FV -> Exp -> Exp
193upp a (Exp b e) = Exp (expand a b) e
194
195up l n (Exp us x) = Exp (upFV l n us) x
196
197-- free variables set
198--fvs (Exp us _) = usedFVs us
199
200usedVar i (Exp us _) = sIndex us i
201
202usedVar' i DExpNil = False
203usedVar' i (DExpCons_ u _ _) = sIndex u i
204
205down i (Exp us e) = Exp <$> downFV i us <*> pure e
206
207---------------------------
208 156
209initSt :: Exp -> MSt 157initSt :: Exp -> MSt
210initSt e = MSt DEnvNil e 158initSt e = MSt DEnvNil e
@@ -221,30 +169,27 @@ hnf = justResult . initSt
221data StepTag = Begin String | End String | Step String 169data StepTag = Begin String | End String | Step String
222 deriving Show 170 deriving Show
223 171
224type GenSteps e 172focusNotUsed (EDLet1 _ x `DEnvCons` _) = False --not $ usedVar 0 x
225 = e
226 -> (StepTag -> MSt -> e)
227 -> MSt -> e
228
229focusNotUsed (MSt (EDLet1 _ x `DEnvCons` _) _) = not $ usedVar' 0 x
230focusNotUsed _ = True 173focusNotUsed _ = True
231 174
232inHNF :: MSt -> Bool 175inHNF :: MSt -> Bool
233inHNF (MSt _ (InHNF _)) = True 176inHNF (MSt _ (InHNF _)) = True
234inHNF _ = False 177inHNF _ = False
235 178
236steps :: forall e . GenSteps e 179steps :: forall e . e -> (StepTag -> MSt -> e) -> MSt -> e
237steps nostep bind (MSt vs e) = case e of 180steps nostep bind (MSt vs e) = case e of
238 181
182 e | EDLet1 _ (down 0 -> Just d) `DEnvCons` vs <- vs -> zipUp e vs d
183
239 Con cn i xs 184 Con cn i xs
240 | lz == 0 || focusNotUsed (MSt vs e) -> step (cn ++ " hnf") $ MSt vs $ InHNF e 185 | focusNotUsed vs || lz == 0 -> step (cn ++ " hnf") $ MSt vs $ InHNF e
241 | otherwise -> step (cn ++ " copy") $ MSt (foldr DEnvCons vs $ ELet "" <$> zs) $ InHNF $ Con cn i xs' -- share complex constructor arguments 186 | otherwise -> step (cn ++ " copy") $ MSt (foldr DEnvCons vs $ ELet "" <$> zs) $ InHNF $ Con cn i xs' -- share complex constructor arguments
242 where 187 where
243 lz = Nat $ length zs 188 lz = Nat $ length zs
244 (xs', concat -> zs) = unzip $ f 0 xs 189 (xs', concat -> zs) = unzip $ f 0 xs
245 f i [] = [] 190 f i [] = []
246 f i (x: xs) | simple x = (up 0 lz x, []): f i xs 191 f i (x: xs) | simple x = (up 0 lz x, []): f i xs
247 | otherwise = (Var' i, [up 0 (lz - i - 1) x]): f (i+1) xs 192 | otherwise = (Var i, [up 0 (lz - i - 1) x]): f (i+1) xs
248 193
249 -- TODO: handle recursive constants 194 -- TODO: handle recursive constants
250 Y x -> step "Y" $ MSt vs $ App x (Y x) 195 Y x -> step "Y" $ MSt vs $ App x (Y x)
@@ -257,14 +202,15 @@ steps nostep bind (MSt vs e) = case e of
257 202
258 DEnvNil -> nostep 203 DEnvNil -> nostep
259 204
260 ELet n x `DEnvCons` vs -> step "goUp" $ MSt vs $ InHNF $ Let n x $ InHNF a 205 ELet n x `DEnvCons` vs -> step "goUp" $ MSt vs $ InHNF $ Let n x $ InHNF a -- TODO: speed up?
261 x `DEnvCons` vs | Let n y e <- a -> step "pakol" $ MSt (upP 0 1 x `DEnvCons` ELet n y `DEnvCons` vs) e 206 x `DEnvCons` vs | Let n y e <- a -> step "pakol" $ MSt (up 0 1 x `DEnvCons` ELet n y `DEnvCons` vs) e -- TODO: speed up
262 x `DEnvCons` vs -> case x of 207 x `DEnvCons` vs -> case x of
263 ECase cns cs -> end "case" $ case a of 208 ECase cns cs -> end "case" $ case a of
264 Con cn i es -> MSt vs $ foldl App (cs !! i) es -- TODO: remove unused cases 209 Con cn i es -> MSt vs $ foldl App (cs !! i) es -- TODO: remove unused cases
265 _ -> MSt vs $ InHNF $ Case cns (InHNF a) cs 210 _ -> MSt vs $ InHNF $ Case cns (InHNF a) cs
266 EOp2_1 AppOp b -> end "AppOp" $ case a of 211 EOp2_1 AppOp b -> end "AppOp" $ case a of
267 Lam _ (down 0 -> Just x) -> MSt vs x -- TODO: remove b 212 Lam _ (down 0 -> Just x) -> MSt vs x -- TODO: remove b
213 -- TODO: optimize out Var 0 application
268 Lam n x -> MSt (ELet n b `DEnvCons` vs) x 214 Lam n x -> MSt (ELet n b `DEnvCons` vs) x
269 _ -> MSt vs $ InHNF $ App (InHNF a) b 215 _ -> MSt vs $ InHNF $ App (InHNF a) b
270 EOp2_1 SeqOp b -> end "SeqOp" $ case a of 216 EOp2_1 SeqOp b -> end "SeqOp" $ case a of
@@ -282,17 +228,17 @@ steps nostep bind (MSt vs e) = case e of
282 int LessEq a b = if a <= b then T else F 228 int LessEq a b = if a <= b then T else F
283 int EqInt a b = if a == b then T else F 229 int EqInt a b = if a == b then T else F
284 _ -> MSt vs $ InHNF $ Op2 op b (InHNF a) 230 _ -> MSt vs $ InHNF $ Op2 op b (InHNF a)
285 EDLet1 _ (dDown 0 -> Just d) -> zipUp (InHNF a) vs d
286 EDLet1 n d -> zipUp (up 0 1 a) (ELet n (InHNF a) `DEnvCons` vs) d 231 EDLet1 n d -> zipUp (up 0 1 a) (ELet n (InHNF a) `DEnvCons` vs) d
287 232
288 where 233 where
289 zipDown 0 e (ELet n z `DEnvCons` zs) = MSt (EDLet1 n e `DEnvCons` zs) z 234 zipDown j e (F.split (> j) -> (t, ELet n z `DEnvCons` zs))
290 zipDown j e (z@ELet{} `DEnvCons` zs) = zipDown (j-1) (z `DExpCons` e) zs 235 = MSt (EDLet1 n (f e t) `DEnvCons` zs) z
291 zipDown j e (z `DEnvCons` zs) = zipDown j (z `DExpCons` e) zs 236 where
237 f e t = t <> e
292 238
293 zipUp x xs DExpNil = end "var" $ MSt xs x 239 zipUp x xs e = end "var" $ MSt (e <> xs) $ up 0 n x
294 zipUp x xs (DExpCons a@ELet{} as) = zipUp (up 0 1 x) (a `DEnvCons` xs) as 240 where
295 zipUp x xs (DExpCons a as) = zipUp x (a `DEnvCons` xs) as 241 n = F.measure e
296 242
297 begin t = bind (Begin t) 243 begin t = bind (Begin t)
298 next t = bind (Step t) 244 next t = bind (Step t)
@@ -318,7 +264,7 @@ class ViewShow a where
318 264
319instance ViewShow Exp where 265instance ViewShow Exp where
320 viewShow vi = pShow where 266 viewShow vi = pShow where
321 pShow e@(Exp fv x) = showFE green vi fv $ 267 pShow e = showFE green vi (fst $ fvLens e :: FV) $
322 case {-if vi then Exp_ (selfContract fv) x else-} e of 268 case {-if vi then Exp_ (selfContract fv) x else-} e of
323 Var (Nat i) -> DVar i 269 Var (Nat i) -> DVar i
324 Let n a b -> shLet n (pShow a) $ pShow b 270 Let n a b -> shLet n (pShow a) $ pShow b
@@ -366,7 +312,7 @@ instance ViewShow MSt where
366 EOp2_2 op x -> shOp2 op (pShow x) y 312 EOp2_2 op x -> shOp2 op (pShow x) y
367 313
368 h n DExpNil = onred $ white $ DVar n 314 h n DExpNil = onred $ white $ DVar n
369 h n z@(DExpCons p (h (adj p n) -> y)) = showFE blue vi (case p of EnvPiece f _ -> f) $ case p of 315 h n z@(DExpCons p (h (adj p n) -> y)) = showFE blue vi (fst $ fvLens p :: FV) $ case p of
370 EDLet1 n x -> shLet n y (h 0 x) 316 EDLet1 n x -> shLet n y (h 0 x)
371 ELet n x -> shLet n (pShow x) y 317 ELet n x -> shLet n (pShow x) y
372 ECase cns xs -> shCase cns y pShow xs 318 ECase cns xs -> shCase cns y pShow xs
@@ -446,7 +392,7 @@ sum' = Y $ Lam "sum" $ Lam "xs" $ caseList (Var 0) (Int 0) $ Lam "y" $ Lam "ys"
446 392
447infixl 4 `sApp` 393infixl 4 `sApp`
448 394
449sApp a b = Seq b (App a b) 395sApp a b = Lam "s" (Seq (Var 0) (a `App` Var 0)) `App` b
450 396
451{- 397{-
452accsum acc [] = acc 398accsum acc [] = acc
@@ -477,14 +423,14 @@ inc = Lam "n" $ Op2 Add (Var 0) (Int 1)
477test'' = Lam "f" (Int 4) `App` Int 3 423test'' = Lam "f" (Int 4) `App` Int 3
478 424
479twiceTest n = (Lam "twice" $ (iterate (`App` Var 0) (Var 0) !! n) `App` inc `App` Int 0) `App` twice 425twiceTest n = (Lam "twice" $ (iterate (`App` Var 0) (Var 0) !! n) `App` inc `App` Int 0) `App` twice
480twiceTest2 = twice2 `App` twice2 `App` twice2 `App` twice2 `App` inc `App` Int 0 426twiceTest2 n = (Lam "twice" $ (iterate (`App` Var 0) (Var 0) !! n) `App` inc `App` Int 0) `App` twice2
481 427
482tests 428tests
483 = hnf test == hnf (Int 13) 429 = hnf test == hnf (Int 13)
484 && hnf test' == hnf (Int 14) 430 && hnf test' == hnf (Int 14)
485 && hnf test'' == hnf (Int 4) 431 && hnf test'' == hnf (Int 4)
486 && hnf (t' 10) == hnf (Int 55) 432 && hnf (t' 10) == hnf (Int 55)
487 && hnf (t'' 10) == hnf (Int 55) 433-- && hnf (t'' 10) == hnf (Int 55)
488 434
489 435
490 436