[Haskell-cafe] Need help using a typeclass within an existing API
ben.franksen at online.de
Tue Jan 28 02:35:33 UTC 2020
> This compiles but I don't get the proper instance of the typeclass
> when I run it
You did not tell us to which concrete type M you instantiate the type
variable m when you run your code. Your wording suggests that you may
misunderstand how instantiation of type variables works: it is the
caller of the debit function who chooses the M; in fact it can choose
/any/ M, as long as it satisfies the listed constraints.
If your code compiles but doesn't work, then the M your caller has
chosen has a wrong instance that doesn't do what it should do. If it is
not obvious from the calling code what the M is, try to use local type
annotations with type holes, so the compiler tells you what the type is.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4211 bytes
Desc: not available
More information about the Haskell-Cafe