# News aggregator

### Help with Data.Map (new to haskell ..)

Hey guys,

I've been looking on the web on how haskell works, but even with google's help I can't figure out what's wrong with my code:

import qualified Data.Map as Map data Env = EmptyEnv | BasicEnv Map.Map String Val | ExtendEnv String Val | GetEnv Env String Val deriving (Show, Eq)The error is this:

Expecting two more arguments to `Map' Expected a type, but `Map' has kind `* -> * -> *' In the type `Map' In the definition of data constructor `BasicEnv' In the data declaration for `Env' Failed, modules loaded: none.Val is another type I deffined.

Until now this tutorial has been helpfull, but now I'm stuck..

Edit: Mistake in the title, I wanted to say that I'm "new to haskell" :)

Solved:

BasicEnv (Map.Map String Val)Works!

Thanks for the help guys!

submitted by husky11[link] [4 comments]

### ANN: Released new version of Haskell plugin forIntelliJ

### Pattern variables in Template Haskell

### Douglas M. Auclair (geophf): October 2014 1HaskellADay Problems and Solutions

**October, 2014**- October 1st, 2014, Wednesday: Pathways into Darkness http://lpaste.net/111444 Because Daerkness is the new Pink. Today's #haskell problem. ...AAAAAND we went there: Dark, Darkest, Darko! http://lpaste.net/111919 A solution to the #haskell grid-pathing problem using Data.Graph. FUN!
- October 2nd, 2014, Thursday: Tweet, tweet! Summer Factorial! http://lpaste.net/111947 a #haskell 'sum'mer exercise for the Fall. From "Power set, HO!" to "Power Sets? NO!" http://lpaste.net/111982 A solution to today's longest factors-sum #haskell problem.
- October 3rd, 2014, Friday: In which I get WHACKED by the Missus for today's #haskell problem http://lpaste.net/112005 (I've printed out the word-ladders in long form so you can give them to your Missus, thus to avoid enWHACKification! http://lpaste.net/112009) GROSS ('Get Rid Of Stupid wordS') club and goal-directed searches using Levenstein distances give us today's solution http://lpaste.net/112064
**BONUS!**puzzles for today: YOU get RICK ROLLED! http://lpaste.net/112006 Oh, yeah! I went there!

- You can't kill the metal, unless you're Rick Rolled; solution to #haskell bonus problem at http://lpaste.net/112127

- October 4th, 2014: Dear Dad, SEND + MORE = MONEY http://lpaste.net/112160 Today's #haskell problem. Problem SOLVED! (naively) ... for a small processing fee, ... ;) http://lpaste.net/112175
- October 7th, 2014: An American Family http://lpaste.net/112220 Today's #haskell problem gives us the #Twilight lexicon... in a 'VERY' 'BRIEF' synopsis. #ontology 8 of 21 questions are answered against the #Twilight (extended) family tree http://lpaste.net/112307 My enthusiasm overcame my reasonableness.
**BONUS**#haskell problem for today! http://lpaste.net/112229 Renesmee's (doting) Aunts because EVERYONE dotes on Renesmee. By law. Do-it-to-it! "And Bella Swan lived Happily Ever After" ... and that's the whole point of the 4-book #twilight series. http://lpaste.net/112339 #ontology- October 8th, 2014: "A more clever approach than brute force is desirable" for today's #haskell problem http://lpaste.net/112310 (Me? Brute Force, All the WAY!) (Not so) Brutish pathing through triangular sums ... Commited Choice FTW! http://lpaste.net/112355 A solution to today's #haskell problem.
- October 9th, 2014: Sugar and spice and everything nice (http://lpaste.net/111904): that's what today's #haskell problem from a logic puzzle from 1957 is made of. A long path to a solution to this day's engagement announcements #haskell problem, involving monoidal Frege logic. http://lpaste.net/112446
- October 10th, 2014: "Oh, it's 4:42. No, it isn't, ... zzzz" Those kinds of conversations come up all the time in today's #haskell problem http://lpaste.net/112404 And the poor little matchstick boy went back to sleep in his warm, comfy bed, hot chocolate by his bedside http://lpaste.net/112461 a solution
**BONUS!**Okay, so you're saying liars ALWAYS lie and TruthTellers ALWAYS tell the truth. http://lpaste.net/112405 Wait ... even in Vegas? #Bonus In which we may learn about your sense of humo(u)r http://lpaste.net/112508 a solution using logic, meta-logic, and coercive logic. #ontology- October 13th, 2014: In which we discover Columbus is Big in Japan ... no, wait: that's #ekmett. http://lpaste.net/112511 Today's #haskell problem. We solve this problem by WAY overusing the State Monad! http://lpaste.net/112537 ... Letter to a Young Haskell Enthusiast should have added: "Don't overused the State Monad!" I hear and obey the advice of ekmett!

- What time is it? π-time? No. (But you were close ...) It's
**BONUS**#haskell problem time! http://lpaste.net/112515 Go discover the New World! And, we discover, solving this bonus problem, that the New World was India (and not the ink),*no matter what anyone else says,*eh, Columbus? http://lpaste.net/112533 - October 14th, 2014: We look at reciprocally-cycled decimal values of fractions in today's #haskell problem http://lpaste.net/112565 In which we discover that @geophf must read the problem statement carefully. A solution to today's #haskell problem http://lpaste.net/112592
- October 15th, 2014: Today's #haskell problem: grid placement http://lpaste.net/112606. Or as Neo says: "Whoa."

- Bam! Interlevening (???) FTW! http://lpaste.net/112647 A solution to today's #haskell problem.

- October 16th, 2014: An ... 'intelligence' test http://lpaste.net/112694 for today's #haskell problem. Intelligence test: answered. http://lpaste.net/112759 I had to melt my brain to answer it, however, so that happened.
- October 17th, 2014: Friedman day was yesterday, http://lpaste.net/112707 but it's today's #haskell problem.
**Bonus:**Friedman*proofs,*no less! http://lpaste.net/112709 ... using Frege's logic ... but only if you want to ... The solution (including the bonus solution) for the Friedman-day problem posted at http://lpaste.net/112735 WITH FOR-LOOPS! - October 20th, 2014: O! Little Town of Milford! http://lpaste.net/112921 has a butcher, baker, and candlestick maker, but who is who? Today's #haskell problem. Okay, gag me with the sequence operator! BLEH! (I really should have gone relational calculus here! :/) A solution at http://lpaste.net/112954
- October 21st, 2014: Se7en Little numbers ... okay, well, four of them, anyway, for today's #haskell problem http://lpaste.net/112972 Quantum nodes of scintillating thought http://lpaste.net/112996 A solution to today's #Haskell problem.

- October 22nd, 2014: Word Numb3rs is today's #haskell puzzle (thanks to @BenVitale) 'AND' in your language of choice as you so choose. http://lpaste.net/113018 Hinglish-Vinglish is our response to this exercise. http://lpaste.net/113045 "Fruitful." Yeah. Well, at least we got Data.Numeral.English http://lpaste.net/113037 out of it. SWEET!
- October 23rd, 2014: Today's #haskell problem comes from http://projecteuler.net and is about ... well: Euler, himself! http://lpaste.net/113069 Well, if you
*wanted*a list of writer monads, you could've just*asked*for a list of writer monads http://lpaste.net/113084 - October 24th, 2014: Even odds is our #haskell problem today, thanks to @BenVitale http://lpaste.net/113141 A solution (actually two defined solutions) to @BenVitale even odds problem posted for today's #haskell problem http://lpaste.net/113167

- October 27th, 2014: #kakuro-week: the empty slate is our step one for our #haskell problem(s) to solve today http://lpaste.net/113255

- Then we have the...'filled'-slate as a solution to 'today's #haskell problems for #kakuro-week http://lpaste.net/113314
- October 28th, 2014: «On y va!» declaims Sgt. Johnson as he charges headlong into solving today's #haskell problem http://lpaste.net/113316
- And that's how a 'partial' cookie crumbles. Partially. A partial solution to yesterday's #haskell #kakuro problem http://lpaste.net/113397
- October 29th, 2014: A magnificent clue for today's #haskell problem in this #kakuro-puzzle-themed week http://lpaste.net/113399
- October 30th, 2014: So, what does the 'Su' mean? http://lpaste.net/113451 Today's #haskell puzzler is a sudoku-solver. That you wrote. DoIt-ToIt!
- October 31st, 2014: Merry Christmas! No. Heurieusement anniversaire! Nope. TRICK OR TREAT! Ya, that's the stuff! http://lpaste.net/113524 Today's #haskell problem

### The Prettiest Printer --- Building pretty-printing library with nicer outputs

### Nomyx (Beta 7): win 10000 Blings!

### Simple Algorithm, beautiful code

### Presumably easy question regarding types

Hello! Could someone please explain the following? Given this function... (Edited for a typo - thanks guys!)

flip :: (a -> b -> c) -> b -> a -> c flip f x y = f y xWhy is this true?

x :: bI thought x would be a? Isn't f :: a -> b -> c? So x is a function which takes a as an argument and returns a function fx which takes b as an argument and returns c? I am so confused and it's being a huge impediment to my getting further into this cool language!

Thanks very much for your help. Sorry this is a very elementary question.

submitted by Orakar[link] [32 comments]

### Help with nix and ghc-mod ?

I was not sure if I should rather post this here or over at /r/nixos but I think quite a few of you are using nix and/or nixos anyhow. This weekend I tried to get started with using nix on my ubuntu laptop and thanks to some friendy guys in #nixos and some blog posts I did get some basic setup running. The problem I am facing right now is with ghc-mod. I cannot get it to work and the errors are absolutely cryptic to me:

[nix-shell : ~/Development/haskell/hoobuddy]$ ghc-mod /tmp/gilligan/ghc-mod-gilligan-Development-haskell-hoobuddy27622/package.cache: getFileStatus: does not exist No Such file or directory)This is my default.nix for this project, the hoobuddy.cabal file was created using cabal2nix. Googling around I did not find much apart from this and I am not sure if this is actually related. Has anyone else here had similar problems or could give me a tip what I need to do to fix this? Any help would be appreciated ;)

Thanks.

submitted by __gilligan[link] [12 comments]

### Neil Mitchell: November talks

*Summary: I'll be talking at CodeMesh 2014 on 5th November and FP Days on 20th November.*

I am giving two talks in London this month:

**CodeMesh 2014 - Gluing Things Together with Haskell, 5th Nov**

I'll be talking about how you can use Haskell as the glue language in a project, instead of something like Bash. In particular, I'll cover Shake, NSIS and Bake. The abstract reads:

A large software project is more than just the code that goes into a release, in particular you need lots of glue code to put everything together - including build systems, test harnesses, installer generators etc. While the choice of language for the project is often a carefully considered decision, more often than not the glue code consists of shell scripts and Makefiles. But just as functional programming provides a better way to write the project, it also provides a better way to write the glue code. This talk covers some of the technologies and approaches we use at Standard Chartered to glue together the quant library. In particular, we'll focus on the build system where we replaced 10,000 lines of Makefiles with 1,000 lines of Haskell which builds the project twice as fast. We'll also look at how to test programs using Haskell, how to replace ancillary shell scripts with Haskell, and how to use Haskell to generate installers.

**FP Days 2014 - Building stuff with Shake, 20th Nov**

I'll be giving a tutorial on building stuff with Shake. It's going to be less sales pitch, more how you structure a build system, and how you use Shake effectively. The abstract reads:

Build systems are a key part of any large software project, relied upon by both developers and release processes. It's important that the build system is understandable, reliable and fast. This talk introduces the Shake build system which is intended to help meet those goals. Users of Shake write a Haskell program which makes heavy use of the Shake library, while still allowing the full power of Haskell to be used. The Shake library provides powerful dependency features along with useful extras (profiling, debugging, command line handling). This tutorial aims to help you learn how to think about writing build systems, and how to make those thoughts concrete in Shake.

### Nomyx: win 10000 Blings!

Join us on Nomyx: www.nomyx.net

It's a unique game where you can change the rules of the game, while playing it.

Log in, and you'll understand better what the title means (check rule 44 proposed by me in the game)!

[link] [8 comments]

### Haskell Dice Of Doom - Part 3

### Discussion: Arities of <*> and *> for Monad instances

### Help With Bindings

I'm relatively new to Haskell and am trying to implement nim, I have written all the code but cannot for the life of me work out the type bindings, the code is long but I was hoping someone could explain to me what the bindings for each function are and why? Thanks.

nim :: ? nim = do putStrLn "Enter first player's name!" n1 <- getLine putStrLn "Enter second player's name!" n2 <- getLine putStrLn "Enter pile amounts, enter 0 to stop adding piles." ps <- getPiles [] w <- play n1 n2 ps f <- (w ++ " has won!") return f play :: ? play n1 n2 ps = do p <- (n1 ++ "'s Turn! \n") putStrLn p displayGame ps m <- getMove nps <- (takeAway ps (getFst m) (getSnd m)) if won ps == True then return n1 else play n2 n1 nps getPiles :: ? getPiles xs = do putStr "Enter amount in next pile : " x <- (read getLine) if x == 0 then do xs ++ [x] getPiles xs else xs getFst :: (Int,Int) -> Int getFst (x,_) = x getSnd :: (Int,Int) -> Int getSnd (_,x) = xThe bindings for other functions used are -

won :: [Int] -> Bool takeAway :: [Int] -> Int -> Int -> [Int] getMove :: IO (Int,Int) displayGame :: [Int] -> IO ()I realize that this might be allot to ask but I have hit a dead end and my "teammates" are of no help.

submitted by con7con[link] [22 comments]

### Haskell on the JVM?

This has been asked before here and here. It would be great to have a JVM backend for Haskell. Why is there no serious effort from the Haskell community to implement it?

submitted by dmz[link] [35 comments]

### runStateT :: StateT s a -> s -> m (a, s)

Anyone else feel that runStateT and friends (execState, runReader etc) would be better flipped? I always find myself writing flip runStateT, because I never need to parameterise the state variable and it's convenient to use multiline do syntax for the action. Just curious.

submitted by scottansan[link] [18 comments]

### How would you simplify this? Guards prevent better pattern matching. :(

Haskell people, any ideas on how I can refactor this code? : http://tinyurl.com/l38hdp3 I use a lot of fromJust and isNothing, which looks horrible, but I cannot pattern match on them because I'm using guards. Since I have a lot of guards that are kinda irregular, using nested ifs seemed worse. Not to mention that the order of the guards matters. I don't see how to pattern match the Maybe values. The current version works but it's ugly. I wonder what you'd do. (By the way, there are a lot of tests in the repo that you can run. The tests cover the requirements of Turkish syllabification) Thanks!

submitted by wavesofthought[link] [14 comments]