Add sized_word_len, which gets the length from a SizedWord type.
[matthijs/master-project/cλash.git] / CoreTools.hs
index 1e71eb14804ee16d6e1ed7b9cb1f8119d7e5cdaf..31af5f8914e9f0b2ce95eb104aa20cef0c997c37 100644 (file)
@@ -41,3 +41,12 @@ eval_tfp_int ty =
 
     core <- toCore expr
     execCore core 
+
+-- | Get the length of a SizedWord type
+sized_word_len :: Type.Type -> Int
+sized_word_len ty =
+  eval_tfp_int len
+  where 
+    (tycon, args) = Type.splitTyConApp ty
+    [len] = args
+