Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: blue storm <bluestorm.dylc@g...>
Subject: Re: [Caml-list] `This expression is not a function it cannot be applied'
On Tue, Sep 2, 2008 at 10:26 AM, David Baelde <> wrote:
> This amouns to provide a cast from the abstract type to the function
> type, while keeping the liberty on how it's implemented.

If you want even more implementation liberty, you should consider
making the internal "token collection" type abstract : you use a list
for now, but might want to use Streams or lazy lists or what not

That would give something like that :
module Parser : sig
  type ('a,'tok) t
  type 'tok input
  val token : ('tok -> 'a option) -> ('a,'tok) t
  val apply : ('a,'tok) t -> 'tok input -> ('a * 'tok input)
  val input_of_list : 'tok list -> 'tok input
end = [...]