|
List types: msg#00035lang.haskell.general
Eric Allen Wohlstadter writes: >I would like to be able to make a list that contains functions which take >arguments of a certain type 'a'. However I don't know how many 'a' >arguments there are. For example I'd like to be able to make a list of >f,g, and h. > >f::a->b >g::a->a->b >h::a->a->a->b >[f,g,h] > >My solution so far is declare a type Element like this: >data Element a b c d = One a | Two b | Three c | Four d >and then I can make my list like this, >[One f,Two g,Three h] Don't you mean this? data Element a b=One (a->b) |Two (a->a->b) |Three (a->a->b) >This gets very ugly. Do you guys have any ideas? I wish you would supply more context, so I could see where the ugliness comes in. Hard to fix a problem you cannot see. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Hugs and Linux: 00035, William Lee Irwin III |
|---|---|
| Next by Date: | Imperative Object Destruction: 00035, Ashley Yakeley |
| Previous by Thread: | RE: A prototype explorer for Haskelli: 00035, Simon Peyton-Jones |
| Next by Thread: | Imperative Object Destruction: 00035, Ashley Yakeley |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |