X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=CoreTools.hs;h=3d3828b45b8c150d4c552759e6202a590a21c7fa;hb=6808406c77307ba110ec5fc7e03fa7359fdf4646;hp=a9114565c9aca9c732bc1c73848637b53a787f79;hpb=430a309686dbaf585844dc129cf7b6aa8568b652;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/CoreTools.hs b/CoreTools.hs index a911456..3d3828b 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -46,7 +46,7 @@ eval_tfp_int ty = core <- toCore modules expr execCore core --- | Get the length of a SizedWord type +-- | Get the width of a SizedWord type sized_word_len :: Type.Type -> Int sized_word_len ty = eval_tfp_int len @@ -69,3 +69,11 @@ eval_type_level_int ty = core <- toCore [] app execCore core + +-- | Get the length of a FSVec type +fsvec_len :: Type.Type -> Int +fsvec_len ty = + eval_type_level_int len + where + (tycon, args) = Type.splitTyConApp ty + [len, el_ty] = args