Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 ... = ...
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