Ask Question

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

0votes0answers28views

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]-... user avatar Ash_5802

  • 1
2votes1answer36views

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) ... user avatar mherzl

  • 4,907
0votes3answers31views

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 ... user avatar Ash_5802

  • 1
0votes0answers25views

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 ... user avatar Seby

  • 93
0votes2answers43views

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 ... user avatar kepich

  • 78
0votes0answers31views

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 ... user avatar kepich

  • 78
0votes1answer66views

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 ... user avatar schuelermine

  • 1,716
1vote2answers79views

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 ... user avatar kannikapu

  • 13
1vote1answer47views

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 ... user avatar teki2021

  • 45
3votes1answer88views

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],[... user avatar hello16

  • 33
1vote1answer50views

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 | ... user avatar smuthu06

  • 31
3votes1answer82views

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 ... user avatar jfhector

  • 33
1vote1answer73views

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 ... user avatar maros

  • 37
4votes1answer72views

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.... user avatar tarleb

  • 15.1k
0votes0answers36views

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 ... user avatar Sandeep

  • 7

153050per page

1 2 3 4 53276