haskell tag

27 questions


2 answers
272 views
0
I want to use Haskell and write a code that multiplies all the numbers in the list.

Now, I'm using Haskell for my school assignment, and I'm writing a code that multiplies all the numbers in the list as the title says.Example) [1,2,3,4,5] - > 120 At this stage, my code is as follo...

2 years ago

2 answers
277 views
0
I want to erase the nth number from the list.

I'm using Haskell to write a code that removes the nth number from the list as I wrote in the title, but it doesn't work.Example) dropvery[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]3[0,1,3,4,6,7,9] * This is the c...

2 years ago

2 answers
420 views
0
I don't know what Monad's m or Functor's f means.Also, I don't understand the notation on the instance side.

To Box Thinking Functor, Applicative, and Monad-Qiita Maybe definition was included.class Monad where (>>=):ma->(a->mb)->mbAnd To Functors, Applied Functors and Monoids-Learn You a Has...

2 years ago

2 answers
415 views
0
Couldn't match expected type 'Tree' with actual type '(Tree, Tree)' I don't understand why it should be

Algebraic data types are expressed in tree structure, but I'm not sure what kind of structure they will be, so I'm posting another question.data Tree=Empty | Leaf Int | Node Tree Tree v=Node(Leaf10...

2 years ago

1 answers
128 views
0
Defining Absolute Values in Haskell

I wanted to define absolute values in Haskell, but I didn't really understand how to define them.By the way, I defined it as follows, but what's wrong with you?abs(x) = if x <0 then -x else if 0<...

2 years ago

1 answers
127 views
0
Haskell does not know the cause of parse error on input|

There is a heading error in line 6 of the code and I don't know why.I can't find the cause of the error even though it's indented and there's no extra = in it.Thank you for your guidance.data T=T {x::...

2 years ago

1 answers
110 views
0
I want to test with selenium webdriver on yesod

I would like to test with selenium webdriver on yesod.The following tests worked.it webdriver load check $do title<-liftIO$runSession(def::WDConfig)$do openPage https://google.co.jp getTitle asse...

2 years ago

1 answers
79 views
0
If you don't use a list,

hogen=[(x,y)|x<-[-n..n],y<-[-n..n]]]How can I write this function without using list inclusion?

2 years ago

2 answers
105 views
0
How can I create a numerical type with a range limit?

I'd like to make a model like Int that limits the range with Haskell.The following instances of the bounded class are not restricted:How can I create a type like Int with a range limit? {-#LANGUAGE Ge...

2 years ago

2 answers
156 views
0
Batch Haskell ghci commands together into a file

Is it possible to combine ghci into a file and process it in bulk?For example, test.hs1+2 3*5I would like to get the following output from ghci by entering the file Prelude>1+2 3 Prelude > 3*5 1...

2 years ago
- 1 - »

© 2024 OneMinuteCode. All rights reserved.