typeclass
Alternative implementations of Haskell's standard library type classes
I\'ve seen many people complaining about some of the type classes from the standard library saying things like \"Monad should require Functor\" or even \"Monad should require Applicative\", \"Applicat[详细]
2023-02-27 02:02 分类:问答Type signature of a function to find the magnitude of a vector
The following type signature to find the magnitude of a vector represented as a tuple doesn\'t seem to work:[详细]
2023-02-26 06:40 分类:问答Question about type classes in Scala
Let there are classes Fruit, Orange, and Apple. abstract class Fruit class Orange extends Fruit class Apple extends Fruit[详细]
2023-02-25 13:20 分类:问答How to make specialized type classes for certain types, default implementation for the rest of types
I would like to have a type class of types that can possibly casted to other types when possible. class Castable a b where[详细]
2023-02-23 01:18 分类:问答Problem with a Functor instance over the keys in Map from Data.Map
I\'m trying to write Eric Kidd\'s and Sigfpe\'s code for a probability monad using Data.Map as a backend but I\'m stuck with a Functor instance.[详细]
2023-02-22 02:08 分类:问答Using a conversion function to make something an instance of a type class
Let\'s say I have: data MyType myToDouble :: MyType -> Double Let\'s say I want MyType to b开发者_开发知识库e an instance of Num or Real or something that Double is already an instance of.[详细]
2023-02-22 01:14 分类:问答How does :t in ghci access all that introspective information?
It appears to be impossible to introspect type class constraints on functions and data types and such. However, ghci appears to do it.开发者_JAVA技巧[详细]
2023-02-21 02:52 分类:问答OO Interface translation to Haskell
My specific problem is actually not about the general translation of an OO interface to Haskell. This is just the best title I could come up with. Yet, I\'m sure that my problem originates from a stil[详细]
2023-02-20 18:01 分类:问答How do I accept parameters restricted only by type class
Code is below. I\'d like to have parameters to my function that are only restricted by type class. I call a function of the type class on them and then I can use them. But I\'m getting various errors[详细]
2023-02-19 16:35 分类:问答Understanding how Either is an instance of Functor
In my free time I\'m learning Haskell, so this is a beginner question. In my readings I came across an example illustrating how Either a is made an instance of Functor:[详细]
2023-02-15 00:30 分类:问答