typeclass
Exporting a polymorphic MonadState function for a particular state data type
What I\'m trying to do is (in a module I\'m writing) export a function that works on a particular type in a state monad (in the example below, that type would be Foo). However I would like the user to[详细]
2023-01-28 06:55 分类:问答Adding type constraints to the context of instance declarations in Haskell
I am trying to represent weighted edges. I eventually want to have OutE to be an instance of Eq and Ord, with the constraint that etype is an instance of Eq and Ord. Assume I have following file as te[详细]
2023-01-25 08:06 分类:问答Degenerate typeclass instance declaration using constant value
I\'ve reduced everything down to the essentials, so bear with me if the example code below is contrived. Let\'s say we have:[详细]
2023-01-22 13:35 分类:问答How would I translate a Haskell type class into F#?
I\'m trying to translate the Haskell core library\'s Arrows into F# (I think it\'s a good exercise to understanding Arrows and F# better, and I might be able to use them in a project I\'m working on.)[详细]
2023-01-22 01:22 分类:问答Is there a Haskell equivalent of OOP's abstract classes, using algebraic data types or polymorphism?
In Haskell, is it possible to write a function with a signature that can accept two different (althoug开发者_Python百科h similar) data types, and operate differently depending on what type is passed i[详细]
2023-01-21 08:17 分类:问答General conversion type class
I\'d like to see if it is feasible to have a type class for converting one thing into another and back again from a mapping of [(a,b)].[详细]
2023-01-21 07:29 分类:问答In Haskell, is there any way to express that a type should be an instance of a typeclass in more than one way?
(Sorry in advance if the question is stupid or obvious -- I don\'t have a lot of experience with Haskell).[详细]
2023-01-20 19:33 分类:问答Polymorphic class-constrained instances
I want to make all types that are instances of Enum and Bounded also an instances of Random. The following code does this and should work (with the appropriate extensions enabled):[详细]
2023-01-20 07:58 分类:问答Using Int type vs. Integral constraint. Advantage?
Consider these (more or less) equivalent type signatures: f1 :: [a] -> Int -> a f2 :: Integral b => [a] -> b -> a[详细]
2023-01-20 05:22 分类:问答How does deriving work in Haskell?
Algebraic Data Types (ADTs) in Haskell can automatically become instances of some typeclasses (like Show, Eq) by deriving from them.[详细]
2023-01-18 23:51 分类:问答