Count Number of Values Passed Into a Haskell Constructor -
suppose have data type
data foo = foo string bool | bar (string->bool)
i want function f does:
f (foo _ _) = [string, bool] f (bar _) = [string->bool]
in particular, i'd function magically know foo , boo constructors, , not give me either of
f (foo _ _) = [string -> bool] -- #don't want this!!!! f (boo _) = [string, bool] -- #don't want this!!!!
how can this? know can print list of records of adt using data.data, can't figure out how print list of typenames.
(if not possible, settle function f' takes in adts , outputs whether or not has 0 parameters.
f'(foo _ _) = false f'(bar _) = false
i want work if don't assign records adt f' operates on.)
Comments
Post a Comment