Questions for haskell


Haskell at a user level

I love coding in Haskell, but often am on a computer where I cannot install software, and which has some restrictions about what you can run. I would like to write Haskell code and test it while on...

How does Reactive Banana's mapAccum function work?

I have looked at a number answers to questions here on Stack Overflow trying to find a solution to my problem in using the Reactive Banana library. All the answers use some magic using 'mapAccum' ...

Type Families extension does not work as described

On the Haskell wiki page for Type Families, there is the following list of examples:

How much math do I need to become productive in Haskell?

I'm interested in learning Haskell on my own time (not through a course), but I suspect that my math background may be insufficient to grok important language concepts (TBD).

Is it square check

I am trying to write function to check if the argument is square of integer:

Parse error in Haskell

The following code:

Purely functional data structures for text editors

What would be good purely functional data structures for text editors? I want to be able to insert single characters into the text and delete single characters from the text with acceptable efficie...

What's the difference between these two function type definitions?

For the following trivial function definitions:

Why does Haskell's “flip id” has this type?

I'm curious about the expression flip id (It's not homework: I found it in the getOpt documentation).

Haskell on Windows Setup

Unfortunately I don't have access to a *nix box at work or at home. The only way I can play with Haskell is on windows. Anyone here using Haskell on Windows? What's your setup?

Why is catching an exception non-pure, but throwing an exception is pure?

In Haskell, you can throw an exception from purely functional code, but you can only catch in IO code.

Haskell - List Comprehension Predicates Optimization

This is an example from Learn you a Haskell:

Haskell HDBC Elegance in F#?

I'm struck by Haskell's terseness and elegance. But I work in a .Net house, so I use F# when I can get away with it--I may be the only one of hundreds across the country who uses it.

Ambigous type variable

I wrote a little haskell program that just counts how many ones there are in a number (Int). When I try to execute it haskell complains about ambigous variable constraints.

How should types be used in Haskell type classes?

I'm new to Haskell, and a little confused about how type classes work. Here's a simplified example of something I'm trying to do:

Haskell: check if two lists are equal

I want to check if two lists A and B are equal, i.e., a1 == b1, a2 == b2,...

How are functors in Haskell and OCaml similar?

I've been toying around in a Haskell for the past year or so and I'm actually starting to 'get' it, up until Monads, Lenses, Type Families, ... the lot.

Haskell Network “accept” unsupported operation (Function not implemented)

I've written a simple web server using Network, System.IO and Data.Bytestring. The components all communicate beautifully on several machines at home running Debian. However, when I attempt to run ...

Haskell gtk2hs closing aboutDialogs

I'm having some trouble with the close buttons of aboutDialogs in gtk2hs. Here is my code

Exporting a polymorphic MonadState function for a particular state data type

What I'm trying to do is (in a module I'm writing) export a function that works on a particular type in a state monad (in the example below, that type would be Foo). However I would like the user t...

Need Help Fixing A little Bug

I posted a question today and someone helped but his code is not working. This is the link to the post link to the post

Haskell int list to String

I would like to know if there is a simple way to turn [5,2,10] into "52a".

Trick for “reusing” arguments in Haskell?

From time to time I stumble over the problem that I want to express "please use the last argument twice", e.g. in order to write pointfree style or to avoid a lambda. E.g.

Confused about this use of a lambda

So I think of Lambdas as demonstrated in Learn You a Haskell:

Trying to improve a current ugly piece of code in haskell dealing with lists

I am trying to implement a function in Haskell that'll take an arbitrary integer list xs and an integer k, and returns a set of lists with k in all possible positions.

Show for IO types

I have a data type which contains an IORef as an important element. This means there is not a clean way to make it a member of the show type class. This is not too bad as I have a print function i...

how to display a list

Here is my code:

Types: (Num a, Ord a) versus (Int a)?

In a file, I'm trying to define a function like this:

Haskell Nested Loop accumulator

I'm working on modifying my server side programming language from PHP to Haskell and am therefore not fully acquainted with functional language design.

What type of scope does Haskell use?

I'm trying to figure out if Haskell uses dynamic or static scoping.

Using data types in Haskell

I have started this a new question as it became a follow-on from my previous question.

Consequences of inability to add natural numbers in C

In System F I can define the genuine total addition function using Church numerals.

how could I take advantage of both State and Writer in haskell?

when I went through the last chapter of LYAH and met with ListZipper, I gave myself an assignment that to make it a State monad so that the source code would look more clear like:

Converting 64-bit Double to ByteString efficiently

I wrote a function to convert 64-bit Double to ByteString (architecture/type safety is not really an issue - let us assume for now that the Double is 64-bit Word). While the function below works we...

Is/Should wrapping functions into a monad transformer be considered bad practice?

Let's say we want to use ReaderT [(a,b)] over the Maybe monad, and then we want to do a lookup in the list.

Haskell how to parse file uploads/multipart form data using Hack?

I'm creating a simple Hack2 app, and I can read body data with:

How to run graphics on winGHCi?

I tried to run graphics (like Graphics.Gloss) on winGHCi, everytime it just froze my winGHCi and I have to restart it. It is even the same if I use "ghc --make" to make the source code and run it.

Haskell Typeclass shorthand

So, I have a pair of typeclasses that I'll be using a lot together, and I want to avoid specifying both each time. Basically, instead of putting

Haskell socket recvmsg (path mtu discovery)

I am writing a tunneling application in Haskell that uses UDP. In order to get it 'right', I would like to set the MTU appropriately. However, I cannot find any easy way to do that.

Comparing functions in Haskell

Is there any way to compare two functions in Haskell?

Doing efficient Numerics in Haskell

I was inspired by this post called "Only fast languages are interesting" to look at the problem he suggests (sum'ing a couple of million numbers from a vector) in Haskell and compare to his results...

persistent: How do I get the I in ACID

Assume I'm doing the following steps in a transaction:

Can I have a value constructor named “/”"?

I've declared a recursive data type with the following structure:

Murmurhash 2 results on Python and Haskell

Haskell and Python don't seem to agree on Murmurhash2 results. Python, Java, and PHP returned the same results but Haskell don't. Am I doing something wrong regarding Murmurhash2 on Haskell?

Mapping Over List In A Tree

I need your help in solving the following 2 functions/problems:

how to create data sub types

I want pass a sub data type into function.

Monad's associativity rule in haskell

(m >>= f) >>= g = m >>= (\x -> f x >>= g)

Linear recurrence relation implementation in Haskell too slow

I have implemented a code that generate the infinite sequence given the base case and the coefficients of a linear recurrence relation.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.