1
vote
3answers
78 views

New to Haskell - Trying to create associative xor chart

I'm trying to create a associate xor chart on Haskell, which to my understanding, should come out true in every instance. Though, when i call my function I get: [True, True, True, False, True, False, ...
4
votes
1answer
194 views

Haskell-like type-constrained trait implementation in Scala (?)

In Haskell you can construct parametrized types as in the following example: data Tree a = Leaf | Node a (Tree a) (Tree a) ..and afterwards make them an instance of a typeclass if the type ...
0
votes
1answer
270 views

Confused about functional languages [closed]

I have been developing in object oriented languages for over 10 years now (both C# and java). But more and more I hear a lot of people talking about functional programming languages: Ruby, Scala, ...
3
votes
1answer
103 views

How to query a URL every timestep using Functional Reactive Programming?

I'm wondering, how would you write a program using Functional Reactive Programming which, every x timesteps, retrieves a JSON object from a given URL? I'm looking in the Elm framework, but I'm open ...
1
vote
0answers
78 views

Haskell/GHC: CPS and performace (time)?

I read about strand sorting alogrithm and wanted to compare it to merge sort at sorting functional lists in Haskell. I implemented simple code, then I tried to boost it with tail-recursion and CPS. ...
11
votes
5answers
608 views

What does the term “reason about” mean in computer science?

While learning functional programming, I keep coming across the term "reason about" especially in the context of pure functions and/or referential transparency. Can somebody explain what exactly does ...
3
votes
1answer
72 views

Composing lenses with Control.Lens where an intermediate function must be called

Suppose I have the following: {-# LANGUAGE TemplateHaskell #-} import Control.Lens data Book = Book { _author :: String, _title :: String } deriving (Show) makeLenses ''Book data Location = ...
12
votes
3answers
414 views

Haskell: What does ((->) t) mean?

In Haskell, what does ((->) t) mean in the type signature of instances? For example Functor, Applicative and Monad all have an instance along the lines of: Functor ((->) r) I can't find any ...
3
votes
1answer
90 views

Does Elm have an equivalent of Haskell's “Read”

I'm currently writing an online game where I use Haskell for the server-side backend and Elm for the frontend/rendering. Right now I have my GameState as one big ADT, in a type simple enough that I ...
9
votes
0answers
295 views

What are the most useful Functional Pearls I should study first? [closed]

Here are the functional pearls. From the top of my mind the Zipper pearl is very useful and is used in XMonad and probably many other real-life applications. Are there any others with similar wide ...
3
votes
2answers
146 views

Combining functions in Haskell

How can I combine these similar function in Haskell? getGroup [] acc = reverse acc getGroup ((Letter x):letfs) acc = getGroup letfs ((Letter x):acc) getGroup ((Group x):letfs) acc = getGroup letfs ...
1
vote
3answers
243 views

From a high level programming perspective, what is the major difference between C# and F#? [closed]

I'm aware that they both use different programming paradigms, but from a high level perspective apart from differing syntax it seems most basic tasks can be achieved in similar fashion. I only say ...
10
votes
4answers
720 views

Is it possible to lazily traverse a recursive data-structure with O(1) memory usage, tail-call optimized?

Let's say that we have a recursive data-structure, like a binary tree. There are many ways to traverse it, and they have different memory-usage profiles. For instance, if we were to simply print the ...
1
vote
2answers
96 views

Exception: Prelude.last: empty list in Haskell solving 8-queens?

I'm solving the 8-queens problem in Haskell using only basic functions nothing fancy this is the code: queens = ...
0
votes
2answers
160 views

8 queens unknown error in haskell

This function isn't terminating! I'm trying to generate all possible safe combinations on an eight by eight chessboard for eight queens. I'm not sure what's going wrong. My code is below. The board is ...

15 30 50 per page