LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

haskell: get lines and handle end of file

Posted 01-01-2013 at 02:23 AM by hydraMax (Bits and Pixels)
Updated 01-01-2013 at 02:27 AM by hydraMax
Tags haskell

I thought I'd post this convenience function, since I didn't see an obvious one in base:

Code:
import Prelude hiding (catch)
import Control.Exception
import System.IO.Error hiding (catch)

readl f = catch (getLine >>= return . Just)
                (\e -> if (isEOFErrorType . ioeGetErrorType) e
                         then return Nothing
                         else ioError e)
          >>= \a -> case a of
...
Member
Posted in Uncategorized
Views 695 Comments 0 hydraMax is offline
Old

Quick and dirty plotting with Haskell + Gnuplot

Posted 12-28-2012 at 05:13 PM by hydraMax (Bits and Pixels)
Updated 12-28-2012 at 05:17 PM by hydraMax
Tags haskell

Assuming you are a Haskeller, you can get a simply x-y plot up very quickly with the gnuplot interface module. This is useful for getting a rough graphical view of some function. Simply...

1. install Gnuplot (through your package manager)
2. cabal install gnuplot
3. use ghci:

Code:
$ ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ...
...
Attached Images
File Type: png image3023.png (29.8 KB, 3 views)
Member
Posted in Uncategorized
Views 2473 Comments 0 hydraMax is offline
Old

Haskell solves the problem of unexpected IO side effects

Posted 12-20-2012 at 02:40 PM by hydraMax (Bits and Pixels)
Updated 12-20-2012 at 02:46 PM by hydraMax
Tags haskell, humor

Programmers are universally familiar with the challenges of dealing with unwanted side effects in IO operations. Few are aware, however, that the Haskell programming language provides a very straightforward approach to dealing with this problem, packaged in a convenient module:

http://hackage.haskell.org/packages/...RealWorld.html

The solution involves making available a full existential state as a retrievable value. This value...
Member
Posted in Uncategorized
Views 573 Comments 0 hydraMax is offline
Old

Haskell shell scripting!

Posted 10-25-2012 at 11:19 AM by hydraMax (Bits and Pixels)

Practical shell scripting AND full-fledged Haskell functional programming at the same time!? Is it really possible to have your cake and eat it too!? I'm sweating with excitement at my recent discovery.

Not only is it possible, but there is a well-developed module that allows you to do shell like programming with Haskell, without losing any of the benefits of the language:

http://hackage.haskell.org/packages/...ml/Shelly.html

...
Member
Posted in Uncategorized
Views 843 Comments 0 hydraMax is offline
Old

Too cool: Haskell Source Analysis

Posted 09-21-2012 at 08:46 PM by hydraMax (Bits and Pixels)
Updated 09-21-2012 at 08:54 PM by hydraMax

I tried out Haskell's SourceGraph program on the project I'm currently working on. It produces tons of cool dependency / analysis graphs. I saved a summary graph in SVG format at the following location:

https://frigidcode.com/ftprepo/edge/...aph-0.1.15.svg

Warning: It is only 374K in size, but it is over 22,000 pixels wide at the default size!

The project in its present form uses an event-based model with an oop-like component structure....
Member
Posted in Uncategorized
Views 618 Comments 0 hydraMax is offline

  



All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration