Add sized_word_len, which gets the length from a SizedWord type.
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Thu, 9 Apr 2009 15:58:59 +0000 (17:58 +0200)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Thu, 9 Apr 2009 15:58:59 +0000 (17:58 +0200)
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
+