basic haskell : Converting Type to Int -
if have type, eg insurance number int.
is there anyway can convert insurancenumber int use in comparing function?
intni :: ni -> int intni x = int (x)
if, suspect, ni defined as
type ni = int then can say
intni :: ni -> int intni x = fromintegral x or, after eta-conversion:
intni :: ni -> int intni = fromintegral on other hand, seems that
data ni = ni int in case right way go pattern matching, so:
intni (ni x) = x this extract x bit out of ni x , return it.
Comments
Post a Comment