(no subject)

Hal Daume III hdaume@ISI.EDU
Mon, 19 May 2003 13:51:08 -0700 (PDT)


First of all, you don't need returns since this isn't a monadic/IO
action.

Second, what is the expected type of this?  Clearly a is an Int and v is a
Wam, right?  But what's the return type.  If you correct the return issue,
you get something like

deref a c = 
  let ...
  in  if tag=="REF" && value/=a
        then deref value c
        else a c

but 'a c' doesn't make any sense.  you can't apply a Wam to an Int.  maybe
you mean 'else (a,c)' or something like that.

--
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume

On Mon, 19 May 2003 l14881@alunos.uevora.pt wrote:

> 
> data Wam = Wam {
> 		falha::String,
> 		h::Int, 
> 		s::Int, 
> 		p::Int, 
> 		heap::Array Int Pares,
> 		registos::Array Int Pares,
> 		e::Int,
> 		b::Int,
> 		mode::Char,
> 		cp::Int,
> 		code::Array Int Int,
> 		trail::Array Int Int,
> 		tr::Int,
> 		hb::Int
> 	       } 
> 	   deriving Show
> 
> 
> 
> 
> deref a c = let (tag,value) = ((heap c)!(a)) in
> 		if ((tag=="REF") && (value /= a)) then
> 		return deref value c
> 		else
> 		return a c
> 
> I would like to do something like that but it gives me an error.
> 
> error:
> 
> ERROR "trab2.hs":373 - Type error in function binding
> *** Term           : deref
> *** Type           : Int -> Wam -> Int
> *** Does not match : Wam -> Int
> 
> 
> Can anyone help, please?? thanks
> 
> 
> 
> 
> 
> _______________________________________________
> Haskell mailing list
> Haskell@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>