Haskell is an purely functional programming language, featuring static typing, lazy evaluation, and monadic effects. The primary implementation is GHC: a high-performance compiler with a runtime supporting many forms of parallelism and concurrency.

learn more… | top users | synonyms

1
vote
1answer
33 views

Recursive Determinant

The following code I devised to compute a determinant: module MatrixOps where determinant :: (Num a, Fractional a) => [[a]] -> a determinant [[x]] = x determinant mat = sum [s*x*(determinant ...
2
votes
1answer
43 views

Haskell MultiWayIf extension: When is it considered useful syntactic sugar?

The new MultiWayIf extension (available with GHC 7.6) allows guard syntax in an if: {-# LANGUAGE MultiWayIf #-} fn :: Int -> String fn x y = if | x == 1 -> "a" | y < 2 ...
3
votes
2answers
87 views

Optimizing unboxed array operations in Haskell

Consider this simplified code which successively permutes array elements: import Data.Word import Data.Bits import Data.Array.Unboxed import Data.Array.Base import Data.Array.ST test3 :: UArray Int ...
2
votes
2answers
234 views

Haskell markov text generator

I'm new to Haskell, and here is my first not-totally-trivial program. It's the first program I tend to write in any language -- a Markov text generator. I'm wondering what I can change to make it more ...
4
votes
3answers
258 views

I'm wondering if I'm doing this whole Haskell thing right

There may not be a "right" way to do it, but I've come to perceive Haskell as the kind of language, where literacy of the proposed programming paradigm is crucial to writing proficient code in the ...
4
votes
3answers
219 views

simple in-memory db

Pretty new to haskell here, I've implemented a very simple in-memory "database" just as an exercise, thought I'd post it here and see if there's anything obvious I should be doing that fits more of ...
3
votes
2answers
112 views

Palindrome test in Haskell

I am new to Haskell and, coming from a OO/procedural programming background, I want to make sure my code follows the functional way of doing things. I built this short module to test if a given string ...
0
votes
0answers
96 views

Could someone profile the space and time complexity of this Haskell snippet?

I'm new to programming and even more new to Haskell, below is a little tid-bit I wrote that operates on a bunch of lists. I am wondering if someone would be kind enough to walk through the function ...
0
votes
0answers
53 views

Haskell network connection graceful handler

Just trying to work out some simple graceful connection handling code in Haskell to get my head around some of the IO/Networking/Threading stuff, some tips where I'm doing things poorly would be ...
2
votes
2answers
157 views

C# state monad implementation

I want to know whether this thing I wrote in C# is a correct implementation of the state monad. I've used it in code and it does what I expect it to do, but I'm still not quite sure if I'm doing this ...
4
votes
2answers
64 views

Is there a way to simple Haskell class instance?

I define a Pixel data with different size like this. data Pixel = RGB8 Word8 Word8 Word8 | RGBA8 Word8 Word8 Word8 Word8 | RGB16 Word16 Word16 Word16 | RGBA16 Word16 ...
3
votes
1answer
92 views

Crtitique my Haskell function 'capitalize'

I am a Haskell beginner. I wrote the following function that takes a string and returns a new string with each word capitalized: first letter uppercase, following letters lower-cased. It works, but I ...
1
vote
0answers
32 views

TOML Parser with Parsec

i wanted to practice parsec and thought about doing a TOML parser for fun. i am looking for both directions on how to fix the remaining problems, but even more some hints on my style. the one ...
5
votes
1answer
98 views

Is there a better way to walk a directory tree?

I just started to learn Haskell, and i wrote a function that walks the directory tree recursively and pass the content of each directory to a callback function: The content of the directory is a ...
5
votes
1answer
101 views

Excessive use of let a problem in Clojure?

I have this set of functions - it works, but I'm concerned about the use of lets. (defn- create-counts [coll] "Computes how many times did each 'next state' come from a 'previous state'. The ...

1 2 3 4 5 9
15 30 50 per page