Re: higher-order functors
Dave Herman <[email protected]> Tue, 23 Jan 2007 11:13:57 -0800
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Sorry, I'm still struggling with this. I'm afraid I'm still new to the
advanced module system features of SML.
> funsig COROUTINE (type result) = sig ... end
>
> functor Generator (functor Coroutine : COROUTINE) : GENERATOR = struct
> ... end
I tried the following:
signature COROUTINE = sig type result ... end
funsig MK_COROUTINE (type result)
functor Generator (functor MkCoroutine : MK_COROUTINE) : GENERATOR =
struct
datatype signal = ...
structure Coroutine : COROUTINE =
MkCoroutine (type result = signal)
...
end
But COROUTINE was too abstract since it didn't know that
Coroutine.result = result. So I changed the declaration of structure
Coroutine to:
structure Coroutine : COROUTINE where type result = signal =
MkCoroutine (type result = signal)
But I got the error "type result does not match definitional
specification". I couldn't figure out what this error means.
At this point I was stabbing in the dark, but I tried moving the
where-clause instead to the declaration of MK_COROUTINE:
funsig MK_COROUTINE (type result) = COROUTINE
where type result = result
But then I got the compiler error:
Error: Compiler bug: LtyExtern: wrong TCs in tc_select
I
Thanks again,
Dave
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV