From 6cd03137e536e134852490f5a736a526cd014da9 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 9 Apr 2009 17:58:59 +0200 Subject: [PATCH] Add sized_word_len, which gets the length from a SizedWord type. --- CoreTools.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CoreTools.hs b/CoreTools.hs index 1e71eb1..31af5f8 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -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 + -- 2.30.2