News aggregator

I'm teaching a (student-run) course on Haskell next semester. Please critique my syllabus!

Haskell on Reddit - Mon, 04/14/2014 - 6:30pm

I'm a student at UC Berkeley, and I'm planning on teaching a Haskell course next year through the DeCal program for student-led classes.

The goal of the course is to get students interested in and proficient with Haskell. It would be mostly practical, but hint at the more theoretical side of things for interested students.

My syllabus so far is here (PDF). Any feedback would be appreciated. Thanks for your help!


Thanks for the feedback, guys. It seems that I'm trying to go way too fast.

submitted by knrafto
[link] [6 comments]
Categories: Incoming News

Any way to find list of files installed with `sudo cabal install xmonad --global'? (ubuntu)

Haskell on Reddit - Mon, 04/14/2014 - 6:30pm

I accidentally installed Xmonad globally, want to remove it, but know there's no uninstall and I have to do it manually. Is there a command that can list the files it installed?

Update: I figured it out by rebuilding XMonad to /opt/haskell/xmonad:

  1. ghc-pkg unregister xmonad
  2. sudo cabal install xmonad --prefix=/opt/haskell/xmonad/0.11 --reinstall
  3. Look at the file structure in /opt/haskell/xmonad/0.11, then manually rm the corresponding files and folders in /usr/local
  4. If you're on Debian or a derivative, use the Debian Alternatives tool to add your /opt/haskell/xmonad as a system installation.
submitted by SkyMarshal
[link] [2 comments]
Categories: Incoming News

Haskell on language-learning platforms

Haskell on Reddit - Mon, 04/14/2014 - 5:58pm

I've been looking for something like Duolingo for programming and Codeacademy seems to be a similar approach, but I don't see a way for volunteers to contribute courses.

It seems like Memrise does this, but there are no courses yet for Haskell. Would anyone want to start working on one?

P.S. Shoutout to

submitted by kxra
[link] [1 comment]
Categories: Incoming News

A question on numeric type literals/dependent types

Haskell on Reddit - Mon, 04/14/2014 - 4:04pm

I'm trying to create a tree that can be stored in a database and lazily retreived, node by node. What I want to do is to use Haskell's type system to ensure that the tree is always balanced, so a sketch of what I'm trying to do would be this:

data Tree depth a = Branch (Tree (depth-1) a) (Tree (depth-1) a) | Leaf 0 a

So, that's obviously not legal syntax, and I haven't been able to figure out if there is some legal syntax for what I'm trying to do. Some other functions would be append:

append :: Tree depth a -> Tree depth a -> Tree (depth+1) a

which does the obvious, and then the really nasty one (that I think Haskell just can't express) is to load a node from the database (I made the "a" concrete here because I really don't care about that):

load :: DBConn -> SomeID -> IO (Tree depth Int)

I think that it's possible to define a data structure that does what my broken example would do (I've read through the tutorials on type-level Peano numbers, and I've tried to understand the new TypeLits stuff but failed), and I would think that the pure function would also be possible to write. The load function might require dependent types, which Haskell doesn't have, right?

What I'm really hoping here is that I'm wrong about the nature of that load function, and that some clever person can show me some trick that Haskell has to look at external data and create some sort of quasi-dynamic type at runtime, and then to somehow make use of that.

submitted by tsuraan
[link] [16 comments]
Categories: Incoming News

24 Days of Hackage 2012 - Mon, 04/14/2014 - 3:22pm
Categories: Offsite Blogs

Learning Haskell & Cryptography

Haskell on Reddit - Mon, 04/14/2014 - 2:28pm

Hi Everyone,

I'm learning Haskell at the moment but I'm tired of just learning syntax and algorithms in isolation. I need a project if I'm to really absorb the language. I'm also trying to learn cryptography.

Due to work and life I don't have that much free time so I thought I might try to combine both and do something with cryptography in Haskell. I've doing the usual Google searches for interesting API's in Haskell etc but I was wondering if anyone could point me towards cryptography tutorials, books articles etc with Haskell.

Also if what I'm trying to do i.e. jamming both side projects into one due to time constraints, is a bad idea please let me know as I don't really have the frame of reference to know otherwise.

submitted by bantersnatch
[link] [13 comments]
Categories: Incoming News

Rascal - Mon, 04/14/2014 - 12:24pm
Categories: Offsite Blogs

ansi-terminal - Mon, 04/14/2014 - 12:24pm
Categories: Offsite Blogs

FP Complete: The heartbleed bug and FP Haskell Center

Planet Haskell - Mon, 04/14/2014 - 8:25am
The heartbleed bug and FP Haskell Center

If you haven't heard about the heartbleed bug and related security issues, this article provides a good explanation.

Applications developed in FPHC and deployed using the FP Application servers are not vulnerable to this bug.

Services we use from Amazon and GitHub were affected. SSL connections to our servers go through Amazon software, and we use SSL to connect to GitHub repositories. Both Amazon and GitHub have already updated their services to remove the vulnerability. FP Complete has followed GitHub's suggestions by changing our passwords and OAuth tokens. You can read those guidelines at github.

While we have no evidence that any sensitive information was leaked from FPHC, we recommend changing your password for FPHC as soon as possible, just in case.

Other measures to increase security never hurt. Things like using two-factor authentication on sites for which it is available, and using password locker software that will generate strong passwords unique to each site, will help prevent people breaking into your accounts. This event provides a good time to consider adding these extra security measures if you aren't already using them.

Categories: Offsite Blogs

Try Idris

Haskell on Reddit - Sun, 04/13/2014 - 7:51pm
Categories: Incoming News

Google Code Jam 2014

Haskell on Reddit - Sun, 04/13/2014 - 6:46pm

Since I rarely find the enthusiasm to practice coding, I'm using this year Code Jam as an excuse.

I'd love if I could get some feedback for my code(github), like if I'm following a good train of thought.

Anyone else is participating?

submitted by MdxBhmt
[link] [6 comments]
Categories: Incoming News

Danny Gratzer: Continuations and Exceptions

Planet Haskell - Sun, 04/13/2014 - 6:00pm
Posted on April 14, 2014

Continuations are useful things. They provide a nice way to manually handle control flow. This fact makes them very useful for compilers, an often used alternative to SSA is an intermediate language in which every function call is a tail-call and every expression has been converted to continuation passing style.

Often however, this isn’t enough. In a language which exceptions, we don’t just have a single continuation. Since every expression can either do one of two things.

  1. Continue the rest of the program normally
  2. Throw an exception and run an alternative program, the exception handler

To represent this, we can imagine having two continuations. Instead of

newtype Cont r a = Cont {runCont :: (a -> r) -> r}

We have

{-# LANGUAGE DeriveFunctor #-} import Control.Monad newtype Throws r e a = Throws {runThrows :: (e -> r) -> (a -> r) -> r} deriving (Functor)

Now we have two continuations, where e -> r represents the composition of exception handlers.

We can write a trivial monad instance similar to Cont

instance Monad (Throws r e) where return a = Throws $ \ex cont -> cont a (Throws c) >>= f = Throws $ \ ex cont -> c ex $ \a -> runThrows (f a) e cont

So >>= maintains the exception handler between computations and otherwise acts exactly like Cont.

To actually take advantage of our exception handlers, we need two things, a throw and catch like pair of function. Let’s start with throw since it’s easiest.

throw :: e -> Throws r e a throw e = Throws $ \ex cont -> ex e

This is pretty straightforward, when we’re given an exception an to throw, we simply feed it to our exception handler continuation. Since care what value cont needs, we can universally quantify over a.

Next up is handle, we’ll represent an exception handler as a function from e -> Maybe a. If we return Nothing, we can’t handle the exception at this level and we’ll just pass it to the existing exception handler.

So our handle is

handle :: Throws r e a -> (e -> Maybe a) -> Throws r e a handle (Throws rest) handler = Throws $ \ex cont -> rest (\e -> maybe (ex e) cont (handler e)) cont

Notice the clever bit here, each handler actually contains both the success and failure continuations! If we can’t handle the exception we fail otherwise we can resume exactly where we were before.

No post would be complete without a demonstration!

data Ex = Boom | Kaboom | Splat String deriving Show throwEx1 = throw Boom throwEx2 = throw Kaboom throwEx3 = throw (Splat "splat") test = do result <- handle throwEx1 $ \e -> case e of Boom -> Just "foo" _ -> Nothing result2 <- handle throwEx2 $ \e -> case e of Boom -> Just "what" Kaboom -> Just "huh?" _ -> Nothing result3 <- handle throwEx3 $ \e -> case e of Splat s -> Just s _ -> Nothing return (unwords [result, result2, result3])

We can run this with

runThrows (error . ("Toplevel fail "++)) test

which returns

"foo huh? splat" A Note on Either

Now we already have a perfectly good system of monadic exception like thing in the form of Either.

It might be interesting to note that what we’ve written is in fact isomorphic to Either. (e -> r) -> (a -> r) -> r is just the church representation of Either e a.

We can even go all the way and change Throws to

newtype Throws e a = Throws {runThrows :: forall r. (e -> r) -> (a -> r) -> r}

So there you are, an interesting realization that one of the classic representations of a language like SML is in fact a really complicated version of Either :)

<script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'codeco'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript> comments powered by Disqus
Categories: Offsite Blogs

"latest API" link in Hackage

Haskell on Reddit - Sun, 04/13/2014 - 1:31pm

There should be a hyperlink banner at the top of the docs of a library for which there's a more recent version. Especially with lens, whose highest Google page rank version happens to be 1.2, I find myself doing this every time:

Google "control.lens hackage" -> click "contents" in top right -> pick latest ver

submitted by MitchellSalad
[link] [14 comments]
Categories: Incoming News

Haskell, Where's the LINQ?

Haskell on Reddit - Sun, 04/13/2014 - 6:13am

Philip Wadler recently gave a very interesting presentation on research he and his colleagues have been doing re: LINQ a la Haskell.

As yet there is, AFAIK, no production ready full blown LINQ-esque library in Haskell. I have checked out HaskellDB, Persistent, and Esqueleto, which leave much to be desired in terms of LINQ syntactic elegance and in some cases, what's even possible (e.g. lack of joins in Persistent).

Coming from Scala where type safe SQL DSLs abound, when can one expect a production ready LINQ in Haskell land?

I'm exploring moving from Scala + Play + ScalaQuery (superior to Slick, IMO) to Haskell + Yesod or Snap + unknown type safe SQL DSL, but am blocked by the database end of things, have no interest in going back to string based SQL.

Thanks for directing me to the missing linq.

submitted by expatcoder
[link] [72 comments]
Categories: Incoming News

I need your help guys !

Haskell on Reddit - Sun, 04/13/2014 - 5:21am

I am fairly new to Haskell, and i want to solve a math problem : 3 sqrt 5 like the third sqrt out of 5. Is there a way to implement this ? Please help me, thank you!

submitted by 13utters
[link] [4 comments]
Categories: Incoming News

Problems installing GHC 7.8.2 on Debian (Ubuntu) x86_64

Haskell on Reddit - Sun, 04/13/2014 - 2:07am

My GHC is working fine now. But there seem to be some changes in either GHC 7.8.2 or Cabal- that have broken some of the older packages in Hackage.

TL;DR I discovered the "Crypto- package is broken, and trying to install "terminfo-" breaks GHC by over-writing the terminfo library that came with the GHC tarball because isn't in the GHC package registry.

I downloaded the binary distribution from here:

and then immediately began re-building all of the packages in my .cabal/packages/ direcotry.

I admit, all of my problems may be due to my Cabal config, but I haven't had any problems with it before this, as far as I know it is the default setup the option to build profiling libraries set to True.

The first problem I had was that Crypto- was not building files correctly. Some of shared object files "*.dyn_o" were being built without their accompanying "*.dyn_hi" files, although some of the "*.dyn_hi" files did exist). When cabal tried to copy these "*.dyn_hi" files to the global package registry during installation it would fail with something about (for example) "could not find RSA.dyn_hi". To solve this, I rebuilt every "*.dyn_o" file that did not have an accompanying "*.dyn_hi" by hand using the command

ghc -dynamic --make Codec.Binary.RSA

The resulting "Codec/Binary/RSA.hi" file was actually a dynamic interface file but it's file extension was just ".hi" for some reason, (I double checked by using ghc --show-iface) so I just copied it it the "dist/build/Codec/Binary/" directory. I did this for every "*.hi" file that was supposed to be named "*.dyn_hi". This included about 10 files. Again, some "*.dyn_o" did build correctly with an accompanying "*.dyn_hi", about 10 of the modules were built incorrectly, all the rest were OK.

The second problem I had was with installing "Yi" which relies on the "terminfo-" package. The "terminfo" library that came with the GHC 7.8.2 binary distribution does not show up in the output of "ghc-pkg list", so Cabal tries to build it thinking it doesn't exist, and it overwrites the existing "terminfo-" package with a library that contains missing symbols. This causes GHC to completely stop working. The "ghc" program immediately fails with an error:

symbol lookup error: /usr/local/lib/ghc-7.8.2/bin/../haskeline- \ undefined symbol: terminfozm0zi4zi0zi0_SystemziConsoleziTerminfoziCursor_moveDown5_info

I was able to solve this problem by simply copying the contents of:


from the source distribution tarball to the GHC installation directory:


and that solved the problem. But any program depending on "terminfo" simply will not install properly. The terminfo- package does not show up in the output of ghc-pkg list, even though it comes with the GHC 7.8.2 tarball and GHC relies on it. Attempting to install Terminfo will build a ".so" file that GHC cannot use. So don't install terminfo- from Hackage.

Fortunately, Yi is not something that is absolutely necessary. I was able to install every other package I needed (lens, diagrams, yesod, xmonad, gtk) without incident.

But whatever changes have been made in ghc-7.8.2 and the accompanying Cabal- seem to have broken some of the older Hackage packages.

Let the users beware.

submitted by Ramin_HAL9001
[link] [1 comment]
Categories: Incoming News

Haskell Data Types in Scheme - Sat, 04/12/2014 - 7:52pm
Categories: Offsite Blogs