From: Matthijs Kooijman Date: Thu, 9 Apr 2009 15:58:59 +0000 (+0200) Subject: Add sized_word_len, which gets the length from a SizedWord type. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;ds=inline;h=6cd03137e536e134852490f5a736a526cd014da9;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add sized_word_len, which gets the length from a SizedWord type. --- 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 +