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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -