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
type error: converting input channel to string list
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-03-14 (18:20)
From: Lyn A Headley <laheadle@m...>
Subject: type error: converting input channel to string list
hi all,

I can't seem to make sense of this type error.  Sorry to air my
dirty laundry but I was hoping I could get some assistance with this
one, as I am stumped.

the code is merely:

(* turn an input channel into a list of strings *)
let string_list_of_chann chann =
  let rec slof_aux (ch: in_channel) (l: string list) = 
      let readstr = input_line ch in
      slof_aux ch readstr::l
    with End_of_file -> l
  in slof_aux chann []

and the error is:

File "query.ml", line 11, characters 19-155:
This expression has type in_channel -> string list -> string list
but is here used with type in_channel -> string -> string
make: *** [all] Error 2

Is this a problem with relying on an exception to type a function?