English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
`This expression is not a function it cannot be applied'
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-09-02 (08:02)
From: Christian Sternagel <christian.sternagel@u...>
Subject: `This expression is not a function it cannot be applied'
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 ... = ...

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?