FAQ Database Discussion Community


Haskell list manipulation performance

haskell,immutability,haskell-platform
I am currently learning Haskell and I am curious about the following: If I add an element to a List in Haskell, Haskell returns a (completley?) new list, and doesn't manipulate the original one. Now let's say I have a List of a million elements and I append one element...

Floating, Ord and RealFloat in Haskell

haskell,typeclass,haskell-platform
I'm trying to figure out why this does not compile yell :: (Floating a) => a -> [Char] yell x | x > 10.0 = "Yelling" | otherwise = "No Yell" but this yell :: (Floating a, Ord a) => a -> [Char] yell x | x > 10.0 =...

How can I tell runhaskell that a module is not in the same folder?

haskell,module,haskell-platform
I want to place a module in a different folder. Is there a possibility to tell in the import statement the path to the module? Note I don't want to use cabal, because in the editor I use, runhaskell is the default executable for haskell.

How to package a Haskell application?

haskell,haskell-platform
I have written a piece of code that I would like to create a binary and distribute to other folks without having them go through the rigmarole of setting up the Haskell platform and cabal. Is there a way to statically link the binary in a cabal build?

How i can compare a variable with a data type in Haskell?

haskell,haskell-platform
data BTree a = Empty | Node a (BTree a) (BTree a) deriving Show type Aluno = (Numero,Nome,Regime,Classificacao) type Numero = Int type Nome = String data Regime = ORD | TE | MEL deriving Show data Classificacao = Aprov Int| Rep| Faltou deriving Show type Turma = BTree Aluno...

Merge two List [“String”,Float] into new list [“String”,Float,Float]

list,haskell,merge,haskell-platform
We need to merge both lists into one who takes de number of frequency who a word appears in lists. If we have: `List 1 [("Hi", 0.45),("Steve", 0.0.5),("Bye",0.9)]...` `List 2 [("Hello", 0.56), ("Steve", 0.6), ("Bye", 0.6)]..` we want to get: [("Hi",0.45,0), ("Steve", 0.0.5, 0.6)... mergeLists :: [(a,Float)] -> [(a,Float)] ->...