Questions tagged [haskell-prelude]

Prelude is the standard Haskell module that is imported by default into all Haskell modules.

Prelude is the standard Haskell module that is imported by default into all Haskell modules unless either there is an explicit import statement for it, or the NoImplicitPrelude extension is enabled.

See full documentation here: http://hackage.haskell.org/package/base-4.10.1.0/docs/Prelude.html

46 questions
1
vote
1 answer

Difference between prelude and yesod with MongoDB

I'm trying to get my MongoDB working in Haskell. I was using this tutorial as a starting point. When I do these commands in prelude, I get a list of collections: pipe <- runIOE $ connect $ Host "XXXXX.mongolab.com" $ PortNumber 33317 access pipe…
taylonr
  • 10,732
  • 5
  • 37
  • 66
1
vote
1 answer

How to resolve issues when getting error: Not in scope

*Main> :t putStrn :1:1: Not in scope: `putStrn' Perhaps you meant one of these: `putStr' (imported from Prelude), `putStrLn' (imported from Prelude) Please note that I am practising haskell programming in emacs with haskell…
Optimight
  • 2,989
  • 6
  • 30
  • 48
1
vote
1 answer

Why do I get an error when trying to `read` this value?

The .hs code : data Person = Person { firstName :: String , lastName :: String , age :: Int } deriving (Eq, Show, Read) Compilation : *Main> :load "/home/optimight/baby.hs" [1…
Optimight
  • 2,989
  • 6
  • 30
  • 48
0
votes
1 answer

Checking corectness of parsers in Haskell

For a uni assignment I need to write parsers in Haskell, right now I have the following parser i think is correct: parseYear :: Parser Char Year parseYear = Year <$> ... I want to check if it works, for example with > parseYear "2004" in ghci. this…
Jord van Eldik
  • 351
  • 2
  • 10
0
votes
1 answer

Where did the haskell list difference operator (\\) go?

Am I missing something? It seems I don't have the list difference operator defined... $ ghci GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help Prelude> "Hello World!" \\ "ell W" :1:16: error: Variable not in scope: (\\)…
scnlf
  • 15
  • 5
0
votes
1 answer

how to change to prelude console in haskell for execution of monads

Hi I am trying to run a custom monad by using prelude as suggested here:Calling a custom monad in haskell using the bind , by using Prelude Control.Monad> runCustomM cm "foo" However when I try to do the import Control.Monad nothing happens an the…
0
votes
1 answer

why does function combine require parantesis in haskell?

Prelude> -- I have 2 functions: f and g Prelude> f x y = x + y Prelude> g x = 2*x Prelude> f 2 3 5 To express $ f(x, g(y))* with x=2 and y=3 this work well: Prelude> f 2 (g 3) 8 why does the following return error ? Prelude> Prelude> f 2 g…
user3313834
  • 7,327
  • 12
  • 56
  • 99
0
votes
3 answers

Cant load Prelude in ghci interpreter in VS code

I have installed Haskell platform following the instructions on chocolatey and haskell.org. I am using Windows 10. My hello.hs program complies in command prompt, but when I try to do the same in VS code, it won't load Prelude, which I assume is…
0
votes
2 answers

How do I modify this Haskell function so I don't have to import Data.Bool and only use prelude function?

I want to build function below using only prelude built in function without importing Data.Bool. I want to replace bool function to something else so I don't have to import Data.Bool and function prints same output as below function. How can I do…
sypy2323
  • 23
  • 5
0
votes
1 answer

Where is IHaskellPrelude coming from in this error?

I'm working in an ihaskell jupyter notebook, so I know the obvious answer to this. But I'm also using an explicit import from Data.List where it shows this error import qualified Data.List as L So I am actually confused about the line that quotes…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
0
votes
1 answer

How can this function be simplified?

This is the function: f [] = [] f (h:t) = (\x -> x - h) : f t It takes a list and returns a list of anonymous functions, that substract each each element from x. Apparently there is some way to write this whole function in 20 characters or…
dYTe
  • 191
  • 1
  • 8
0
votes
0 answers

haskell movie database no parse

I have been wondering why I keep getting the error: *** Exception: Prelude.read: no parse. This happens after i go through my code and select option 2. This is defining Film type Title = String type Director = String type Year =…
AndyGos
  • 1
  • 1
0
votes
1 answer

Haskell: how to view command history inside "Prelude"?

Hello: I wish to list all historical command in Prelude, in the way that any unix shell could in "history" command. I tried several guesses but failed. How can I do that?
vik santata
  • 2,989
  • 8
  • 30
  • 52
0
votes
0 answers

Passing constructors and Data as arguments in Haskell

I am trying to build a small error checker for a game I am working on and I am unsure of how to pass Data types as arguments. here is what I am trying to do this is the file where my data arguments are -- | Represents the type of move played in a…
AVC
  • 61
  • 5
0
votes
2 answers

Make and run, beginsWithU function in prelude

How can i define, run this function in prelude, let beginsWithU (c:_) = c == 'u' || c == 'U' beginsWithU _ = False Line number 2, gives parse error on input ‘=’. I cannot use let again since it will override the pattern in line 1.
user2879704