caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* `This expression is not a function it cannot be applied'
@ 2008-09-02  8:00 Christian Sternagel
  2008-09-02  8:26 ` [Caml-list] " David Baelde
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Sternagel @ 2008-09-02  8:00 UTC (permalink / raw)
  To: caml-list

Is there a way to be able to apply something of an abstract data type 
without knowing the internal representation?

E.g., when having the module
module Parser : sig
  type ('a,'tok) t
  val token : ('tok -> 'a option) -> ('a,'tok) t
end = struct
  type ('a,'tok) t = 'tok list -> ('a * 'tok list)
  let token ... = ...
end

I want to be able to apply the result of (token (function Ident s -> 
Some s | None)) to some further input (since it is a parser), however, 
this is not possible since the result type is not functional.

The only way out I see is to `unabstract' the type and give its internal 
representation. Or is there another possibility?

cheers

christian



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-02  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-02  8:00 `This expression is not a function it cannot be applied' Christian Sternagel
2008-09-02  8:26 ` [Caml-list] " David Baelde
2008-09-02  8:34   ` blue storm
2008-09-02  8:46     ` David Teller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).