[Haskell-beginners] Couldn't match expected type with actual type

Alexander _ anotherworldofworld at gmail.com
Fri Dec 7 15:02:23 CET 2012


Hello,

I have function with following signature:

get :: a -> Value b

I don't know concrete type of b. It can be Value Int or Value String or
something else. How can i to write function only for testing? I need
something like this:

get :: a -> Value b
get k = (Value "some_data"')

but i got error:

Couldn't match expected type `b' with actual type `[Char]'
`b' is a rigid type variable bound by
  the type signature for get :: a -> Value b
  at Test.hs:39:8
  In the first argument of `Value', namely `"some_data"'
  In the expression: (Value "some_data")
  In an equation for `get': get k = (Value "some_data")
Failed, modules loaded: none.

Value data declaration:

data Value b = Value b deriving (Show)


Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121207/eb0a9fd5/attachment.htm>


More information about the Beginners mailing list