Haskell is an advanced functional programming language, featuring strong static typing, lazy evaluation, extensive parallelism and concurrency support, and unique abstraction capabilities.
0
votes
0answers
4 views
Hamlet templates doesn't update
I'm new in Yesod. I have strange problem - I have created new Yesod application with cabal-dev
yesod init
and tried modify templates/homepage.hamlet . When I restarted development service, I didn't ...
0
votes
0answers
13 views
What's the difference between module, package and library in Haskell?
What's the difference between module, package and library in Haskell?
From http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html
Prelude: a standard module imported by default into ...
0
votes
0answers
18 views
How to prevent g++ from not inlining inline functions (to enable Haskell FFI use in GHCI)
I have recently met an issue with C++ inline functions when using Haskell FFI to C/C++.
Namely, g++ does not really inline functions that are declared inline, and generate symbols for them. ...
2
votes
1answer
33 views
No stream fusion with unsafeUpdate_ in unboxed vector
Is it possible to maintain stream fusion when processing a vector if unsafeUpdate_ function is used to update some elements of a vector? The answer seems to be no in the test I did. For the code ...
1
vote
1answer
65 views
Is there a way I can write this Haskell code in Scala?
I'm going through a few functional programming languages, learning things of interest, and I'm looking at Scala now. What I'm trying to do is figure out the simplest way to write a function called ...
0
votes
1answer
29 views
Language.Haskell.Interpreter - how to properly call IO actions?
Following the example file, I try to dynamically call an IO action.
testHint :: Interpreter ()
testHint = do
setImportsQ [("Prelude", Nothing)]
let somecode = ...
1
vote
1answer
59 views
Bug in while loop
I can't figure out what the bug is in the toy while loop I wrote below. It works for one input, but hangs for other inputs. Here is the code - the while loop takes a vector, a predicate on vector, and ...
3
votes
0answers
43 views
Why am I getting this type compatibility error with Database.PostgreSQL.Simple?
The error is
*** Exception: Incompatible {errSQLType = "int8", errHaskellType = "Int", errMessage = "types incompatible"}
It looks like any value returned by count(*) in the query must be converted ...
3
votes
1answer
54 views
Writing a Show instance for Data.Functor.Compose without FlexibleContexts
I'm experimenting with Data.Functor.Compose and wanted to write a Show instance for it when trying things out in ghci. What I have (which is working) is:
{-# LANGUAGE FlexibleContexts #-}
instance ...
4
votes
1answer
53 views
Parse a list whose separator may also occur at the end
I am trying to parse some text, but I can't understand how to parse a list of symbols separated by some separator, which may or may not occur also at the end of the list.
Example (numbers separated ...
1
vote
1answer
63 views
Implementing Karatsuba algorithm in Haskell
I just got to know about Karatsuba Algorithm, and I tried to implement it in Haskell.
Here is my code:
(***) :: Integer -> Integer -> Integer
x *** y
| max x y < ub = x*y
| ...
1
vote
1answer
50 views
Haskell: typeclass and instance (Not in scope: data constructor..)
I want to make a typeclass Size with a method that given a value computes the number of
constructors in this value.
class Size a where
size :: a -> Int
instance Size Int where
size a = 1
...
2
votes
2answers
82 views
Serial Comprehension in Haskell
Say one wants to run some kind of comparison on a list of combinations, for example:
combs [] r = [r]
combs (x:xs) r = combs xs (x:r) ++ combs xs r
answer = minimumBy (\a b -> compare (length ...
1
vote
0answers
53 views
How to cross-compiling on Linux to Windows by GHC?
Is it possible to compile a foo.hs file by GHC in Ubuntu to an executable targeting windows or other platforms?
1
vote
1answer
17 views
ParseError in Yesod.Core.Class.Yesod
I have a Yesod web application, that calls a web service on another server. I reuse the Http Manager from yesod for my Requests to that web service.
On some calls, I'm getting a Yesod error, and I'm ...