Haskell is a purely functional programming language featuring strong static typing, lazy evaluation, extensive parallelism and concurrency support, and unique abstraction capabilities.
49,128
questions
0
votes
0
answers
28
views
Type error in application type does not match
nextMyStates::MyState->[MyState]
nextMyStates(s) =[up(s),down(s),left(s),right(s),collect(s)]
isGoal::MyState->Bool
isGoal (S (l) (al) d z) = if al == [] then True else False
search::[MyState]-...
2
votes
1
answer
36
views
How to explicitly import 'Fn' pattern from Test.QuickCheck?
Haskell's Test.QuickCheck module exports pattern Fn, which I have been using.
When I import it with:
import Test.QuickCheck
it works fine. However, when I import it with:
import Test.QuickCheck (Fn)
...
0
votes
3
answers
31
views
Syntax error in expression (unexpected `;', possibly due to bad layout) in line 50
Hello I'm writing this code as a beginner Haskell project that solves a very basic version of minesweeper. Details are unimportant but I keep getting a syntax error on line 50 in the isGoal function ...
0
votes
0
answers
25
views
yesod installation fails.. haskell --ghc-options " -fdiagnostics-color=always"
I am trying out yesod tutorial from
On step no 3 stack install yesod-bin --install-ghc
I get an error as shown below
stack install yesod-bin --install-ghc ...
0
votes
2
answers
43
views
Create haskel socket client
I try to connect to created socket by haskell:
-- Logger
putStrLn "Create socket"
sock_logger <- socket AF_INET Stream 0
putStrLn "Bind socket"
connect ...
0
votes
0
answers
31
views
Could not find module `Network' Haskell Stack
System: Windows 10, Haskell version latest.
I'm use Stack package manager. I want to add Network package - network dependency was added in package.yaml
dependencies:
- base >= 4.7 && < 5
...
0
votes
1
answer
66
views
Is there a platform-independent way to check if a file path is some representation of a root directory in Haskell?
In Haskell, is there a portable way to check of a FilePath if it’s a root directory, e.g. / or // on Unix/POSIX/Linux, and C:\ or \\?\UNC\Foobar on Windows/NT/DOS? I’ve checked through the directory ...
1
vote
2
answers
79
views
Haskell - Apply list of functions to a variable
I have been trying to implement a function that applies a list of functions given as a parameter to a given variable. I have been running into various type errors with infinite types and type ...
1
vote
1
answer
47
views
How can I find all words in a string which have a capital letter?
a is a string and I would like to find all words in the string which have an upper case character.
How can I convert the string to chars?
listWordsWithUpper :: String -> [String]
listWordsWithUpper ...
3
votes
1
answer
88
views
How can I only slice the list when the function is not true in haskell?
I would like to slice my list when the function is not true, but I do not have an idea what I have to give back in the otherwise case. Do you have any idea ?
Example :
sliceBy odd [1..5] == [[1],[2],[...
1
vote
1
answer
50
views
Non-exhaustive patterns in function - Maybe type [duplicate]
In the following function definition I am getting Non-exhaustive patterns in function tapChar.
What am I missing?
reverseTap :: DaPhone -> Char -> [(Digit, Presses)]
reverseTap phone s
| ...
3
votes
1
answer
82
views
Why is this code hanging when I execute it?
What I'm trying to achieve
As an exercise, I'm trying to write a 'mergeSorted' function which takes two lists, and returns a single list, in which all the elements from the two lists are sorted.
For ...
1
vote
1
answer
73
views
How can I build a haskell '#' mountain?
Define a function called mountain that draws a mountain of height n and width that can be climbed from the east (right). Widen the mountain from top to bottom by one character per line. The mountain ...
4
votes
1
answer
72
views
When using bracket with a Ptr as resource, can it be replaced with ForeignPtr?
My code uses a resource that can be described as a pointer; I'll use a void pointer here for simplicity. The resource must be closed after the computation with it finishes, so the Control.Exception....
0
votes
0
answers
36
views
Restarting with Mod - q is slow after installing xmonad with stack instead of pacman
After learning that the recommended method of installing xmonad on arch is using stack/cabal, i uninstalled the pacman package and installed it with stack. Mod - q was not working initially, but ...