Matthias Fischmann wrote:
now i want to create a list of a type similar to

  [r1, r2, r3] :: (Resource a) => [a]

but with r1 being pizza, r2 being crude oil, and so on.

The type you actually want here is [exists a. (Resource a) && a], but no Haskell implementation supports that.

  data Rs = forall a . (Resource a) => Rs a
  unRs (Rs a) = a
  rsName :: Rs -> String
  rsName = resourceName . unRs
  ...

[...]

but what is the type of unRs?

Its type is (Rs -> (exists a. (Resource a) && a)), but again no Haskell implementation supports that.

-- Ben

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to