haskell
Commutative function in Haskell
I want to write a function in haskel开发者_StackOverflow中文版l which would not mind in what order I provide it its argument, for example, I want to unify these two functions[详细]
2023-04-10 14:33 分类:问答Using the stdout and stdin with System.IO.runCommand
I am trying to capture the stdin and stdout from runProcess into a string for analysis. However, setting up the handles seems to be rather difficult.I wandered into GHC.IO.Handle, and that seems to b[详细]
2023-04-10 13:21 分类:问答Matrix constructor and method in Haskell
So here is a nested list [[1, 2], [3, 4]] I want to wrap it in a type called Matrix, and make it an instance of the classes Eq, Num, and Show[详细]
2023-04-10 13:18 分类:问答Reversing a string (or list) recursively
I\'m trying to write a function in haskell that reverses lists recursively. I wrote a helper function that takes the original list and an empty list then transfers elements from the first one to the o[详细]
2023-04-10 13:09 分类:问答type declarations in 'where' -- what's going on?
While reading the QuickCheck Manual, I came across the following example: prop_RevRev xs = reverse (reverse xs) == xs[详细]
2023-04-10 12:52 分类:问答Can compiler optimizations, like ghc -O2, change the order (time or storage) of a program?
I\'ve got the feeling that the answer is yes, and that\'s not restricted to Haskell.For example, tail-call optimization changes memory requirements from O(n) to O(l), right?[详细]
2023-04-10 12:48 分类:问答Haskell - declare/use data
It\'s my first time to use data types in Haskell. Got a problem and I don\'t know how to improve the code.[详细]
2023-04-10 12:30 分类:问答How to evaluate IO Bools in Haskell
I\'m trying to write a function that takes an IO Bool and does stuff based on what this is, but I can\'t figure out how to evaluate the IO Bool. I tried saying do cond and do {cond==True} but got the[详细]
2023-04-10 12:07 分类:问答Haskell "pseudo-functor"
I have a polynomial data Poly a = Poly [a] I would like to be able to do something like fmap (take3) polynomial but I can\'t since Poly isn\'t really a functor in that the f I use in fmap can only[详细]
2023-04-10 10:42 分类:问答Longest common subsequence (Haskell)
I\'ve been 开发者_开发百科struggling with this for a while. I\'m solving the longest common subsequence problem in Haskell as a learning exercise.[详细]
2023-04-10 09:57 分类:问答