[add routine to test if primitives are inexpensive and convienience routine for infering types
John Meacham <john@repetae.net>**20051021032114] hunk ./C/Prims.hs 32
+-- | These primitives may safely be duplicated without affecting performance or
+-- correctness too adversly. either because they are cheap to begin with, or
+-- will be recombined in a later pass.
+
+primIsCheap :: Prim -> Bool
+primIsCheap AddrOf {} = True
+primIsCheap CCast {} = True
+primIsCheap CConst {} = True
+primIsCheap Operator {} = True
+primIsCheap _ = False
+
+aprimIsCheap (APrim p _) = primIsCheap p
+
hunk ./CanType.hs 3
+import Control.Monad.Error()
hunk ./CanType.hs 12
+
+infertype :: CanTypeCheck env a ty => env -> a -> ty
+infertype env a = case typecheck env a of
+    Left s -> error $ "infertype: " ++ s
+    Right x -> x
+