Rigid types fun

Mitar mmitar at gmail.com
Fri Nov 5 07:08:52 EDT 2010


On Fri, Nov 5, 2010 at 10:49 AM, Bulat Ziganshin
<bulat.ziganshin at gmail.com> wrote:
> Friday, November 5, 2010, 12:45:21 PM, you wrote:
>> from <- newChan
>> for <- newChan
>> let nerve = Nerve (Axon from) (AxonAny for)
> create = do from <- newChan
>            for <- newChan
>            return$ Nerve (Axon from) (AxonAny for)
> main = do nerve <- create
>          ...

OK. It is necessary to check the attached file to understand. ;-)

I would like to call it like "create (Axon undefined) (AxonAny
undefined)" and get in that case "Nerve (Axon a) (AxonAny b)" as a
result. If I would call it like "create (AxonAny undefined) (AxonAny
undefined)" I would get "Nerve (AxonAny a) (AxonAny b)" as a result.
And so on.

So I know I can move some hard-coded combination into a function. But
I would like to cover all combinations and tell with arguments which
combination I want.


More information about the Glasgow-haskell-users mailing list