News aggregator

[ANN] rtorrent-state

haskell-cafe - Thu, 08/07/2014 - 8:07pm
Hi, rtorrent-state is a library that allows working with rtorrent state files (SOMEHASH.torrent.rtorrent) placed in your session directory. If you're an rtorrent user and ever had to manually muck around with those files, you should be able to use this library to make your life easier. For example, you can stop all torrents in your session directory with just: “overFilesIn "rtorrent/session/dir" stopTorrent” The way it works is by parsing the session files, modifying the resulting data type and serialising it back into the file. I did not do optimisation but I had no problem with test sample of 100,000 files. I need to add IOException handling and maybe extra utility functions but otherwise I consider the library finished. Thanks
Categories: Offsite Discussion

Performance of StateT and best practices fordebugging

haskell-cafe - Thu, 08/07/2014 - 6:57pm
Hello, I was looking at cleaning up my refactoring a core loop of template rendering to go from a loop with many parameters loop :: RenderConfig -> BlockMap -> InputBucket m -> Builder -> [Pieces] -> ExceptT StrapError m Builder to a looped state monad transformer loop :: [Pieces] -> RenderT m Builder newtype RenderT m a = RenderT { runRenderT :: ExceptT StrapError (StateT (RenderState m) m) a } deriving ( Functor, Applicative, Monad, MonadIO ) data RenderState m = RenderState { position :: SourcePos , renderConfig :: RenderConfig , blocks :: BlockMap , bucket :: InputBucket m } however, there is a big slow down (about 6-10x) using a StateT. I think it might have something to do with laziness but I am not exactly sure of where to begin in tracking it down. Swapping out the Lazy State to a Strict State helps a little (only a 5x slow down) You can find some of the processing code here:
Categories: Offsite Discussion

parsec: problem combining lookAhead with many1 (bug?)

haskell-cafe - Thu, 08/07/2014 - 3:25pm
Suppose that we have the following parser: p = lookAhead (char 'a') >> char 'b' If we use it like so parse p "" "a" we get the following error: Left (line 1, column 1): unexpected "a" expecting "b" What happened is that char 'a' succeeded by consuming the 'a' from the input and then lookAhead rewinded the input stream (as it does on success). Then, char 'b' tries to parse (again) the first character of the input and fails. Everything works as expected. Now let's slightly modify our parser: p' = lookAhead (many1 $ char 'a') >> char 'b' I've only added a many1. I was expecting this parser to give the same error as the previous one: many1 $ char 'a' will succeed consuming one 'a' and then lookAhead will rewind the input (as it does on success). Thus when we call char 'b' we are going to be in the beginning of the input again. Well, that doesn't happen: Left (line 1, column 2): unexpected end of input expecting "b" As you can see, lookAhead did not rewind the input as it was supposed to.
Categories: Offsite Discussion

Free monad based EDSL for writing LLVM programs.

haskell-cafe - Thu, 08/07/2014 - 3:16pm
Hello. I'm new with Haskell and FP, so i wanted someone to give comments on the package i've made [1]. It's, actually, my first attempt to create something more or less real, so any feedback would be welcome. I've used Free monad to create EDSL that allows writing LLVM IR code. Afterwards it could be converted into pure AST structure provided by llvm-general-pure[2] package. Currently, it supports almost every instruction, but i haven't yet come up with sensible defaults for them. Another thing that bugs me is the ability to transform the code in syb way. I want take a user-supplied function that would pattern-match instruction and produce another code block and apply this function everywhere in the code, but still can't get my head around it. I've come up with extF function, that unlike extM, would resort to wrap instead of return, but that's all i've managed to do. Thanks in advance. [1] [2] _______
Categories: Offsite Discussion

Haskell Weekly News: Issue 301

haskell-cafe - Thu, 08/07/2014 - 5:43am
Welcome to issue 301 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from July 27 to August 2, 2014 Quotes of the Week * bernalex: I used to have a problem then I used lens now I have an abstraction problem? * trap_exit: haskell is like the 'and they lived happily ever after' of programming languages Top Reddit Stories * The Comonad.Reader » Letter to a Young Haskell Enthusiast Domain:, Score: 236, Comments: 56 Original: [1] On Reddit: [2] * seL4 is now open source: the world's first end-to-end verified OS kernel Domain:, Score: 87, Comments: 20 Original: [3] On Reddit: [4] * FP Haskell Center now free for open projects Domain:, Score: 81, Comments: 23 Original: [5] On Reddit: [6] * -XOverlappingI
Categories: Offsite Discussion

cabal repl failing silently on missing exposed-modules

glasgow-user - Wed, 08/06/2014 - 3:18pm
Hi, I have just spent some time trying to figure out why all of a sudden "cabal repl" silently exits without an error message. What helped was to take a project that could launch the repl and compare the cabal files to my new project. It turns out the exposed-modules entry was missing. I was wondering whether this behaviour was intentional, as I don't recollect this happening before, but I don't have older systems to test this on. The reason I wanted to run a repl without editing exposed modules was to test some dependencies I pulled in to the sandbox with cabal install. The package in question didn't have any code of its own yet. In this case I would just expect ghci to load with the Prelude. Thanks!
Categories: Offsite Discussion

Side-by-side pretty printing

haskell-cafe - Tue, 08/05/2014 - 8:49pm
Hi all, When looking into Text.PrettyPrint, I stumbled upon <> (beside) combinator. Is it true that multi-line documents can't be printed one beside other? E.g. this let doc1 = vcat $ map text ["This", "is", "a", "document"] in doc1 <> doc1 prints this: This is a documentThis is a document As well as if I would write `doc1 <> nest 50 doc1`. What I was expecting, was This This is is a a documentdocument Do I get it right that Text.PrettyPrint was not intended for such things?
Categories: Offsite Discussion

Old code broken by new Typeable class

glasgow-user - Tue, 08/05/2014 - 5:41pm
Hi! I've been working with GHC-4.6.3, and updating to GHC-4.8.3 breaks my code, because the Typeable class has been changed. The compiler produces this message: --------- src/HsShellScript/ProcErr.chs:2294:4: ‘typeOf’ is not a (visible) method of class ‘Typeable’ --------- I want to define System.Posix.Process.ProcessStatus to be an instance of Typeable, so I can throw and catch it as an exception. ProcessStatus isn't typeable by default. Is it still possible to make ProcessStatus a member of Typeable? How? Obviously, you can't accomplish it by deriving Typeable, because the definition can't be changed any longer. This is the spot in question: ---------- import System.Posix.Process import Data.Typeable {- data ProcessStatus = Exited ExitCode / | Terminated Signal/ / | Stopped Signal/ deriving (Eq, Ord, Show) -} instance Typeable ProcessStatus where typeOf = const tyCon_ProcessStatus tyCon_ProcessStatus = mkTyConApp
Categories: Offsite Discussion

Dealing with encodings

haskell-cafe - Tue, 08/05/2014 - 1:00pm
Hello! How teach hxt to handle "KOI8-R" encoding of input file? And it seems that so many great packages (like hxt, feed, curl) uses String. Is it some work in progress to port them to Text? -- Best regards, Dmitry Bogatov <KAction< at >>, Free Software supporter, esperantisto and netiquette guardian. GPG: 54B7F00D _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Applicative & Monad as interaction between categories

haskell-cafe - Tue, 08/05/2014 - 9:46am
Hi all, I recently came across of two blog posts[1][2] by Gabriel Gonzales where he shows motivation for writing compositional functions -- and thus why the concept of category is useful -- and motivation to write functors between them. I wanted to know if something similar for has been done to `Applicative' and `Monad' as design pattern and interaction between categories. I've searching but I always hit the Monad tutorials and more info on how to use them. Thanks in advance. Excuse my English. [1]: [2]:
Categories: Offsite Discussion

Building network without MSYS [Was: Splitting Network.URI from the network package]

libraries list - Mon, 08/04/2014 - 9:52pm
Hello. I consider the original proposal to be well founded and I support it. However, I started to think if there is anything we can improve about installation of network package itself? Maybe we can get rid of MSYS, at least for the end users of network package? How would that happen? The following plan came to my mind: 1. Select a single supported configuration (Windows version) 2. Execute a "normal" build with MSYS 3. Extract a configuration that was "discovered" by MSYS 4. Bake in the configuration into installation files to be used on Windows when MSYS is not present. There shouldn't be that many supported configurations on Windows. I think it is reasonable to do: 1. Windows XP 2. Windows 7 3. Windows 8 4. some Windows Server versions? For each system the variants would be: 1. 32-bit system, 32-bit GHC 2. 64-bit system, 32-bit GHC 3. 64-bit system, 64-bit GHC Right now I have done the procedure above for my own 64-bit Windows 7/32-bit GHC pair. I also added some simple logic of choosing between "Sim
Categories: Offsite Discussion

[ANN] StrappedTemplates - general purpose templates

haskell-cafe - Mon, 08/04/2014 - 6:40pm
Hello all, I found that I wasn't quite satisfied by the template offerings (Heist, Hastache, Shakespearean, etc..) of Haskell, so I built my own. The goal is to have simple syntax that non-haskellers would be comfortable using, resembles templates found in other languages (Jinja, Django, etc) and an interface to render them that I don't have to think very hard to use. Features include inheritance, logic, includes, functions, and relatively speedy rendering (much faster than interpreted templates like Heist-I and Hastache) . Its very much a work in progress, but I felt that it was enough for an initial release and get general feedback on it. Comments are appreciated. One thing that I want to improve is how functions are handled in the template and in the "InputBucket", extend the syntax to allow you to do more inside the template and be able to define your own block functions. These will probably be added next major release.
Categories: Offsite Discussion

New Functional Programming Job Opportunities

haskell-cafe - Mon, 08/04/2014 - 5:00pm
Here are some functional programming job opportunities that were posted recently: Pragmatic Haskell Developer at Anchor Systems Cheers, Sean Murphy
Categories: Offsite Discussion

"Standardising" Haskell AST for tooling

haskell-cafe - Sun, 08/03/2014 - 8:27pm
Hi all I am looking at updating HaRe for GHC 7.8.3, and I am fighting my way through the AST changes. One of the things I have had at the back of my mind for a while is to use something like Kure universes or more generally lens to provide a set of isomorphisms from the various flavours of AST into some kind of standardised internal representation, allowing easier tool manipulation. This could potentially decouple the tools from the specific compiler/analyzer, so they could work across GHC 7.6.x, GHC 7.8.x, haskell-src-exts, haste, etc.. Obviously there would be limitations to this where an advance in the language brings in new features, but a lot of useful tool work can be done that does not touch the new stuff. I don't know if anything similar is planned in either ghc-server or another toolchain. My haskell-token-utils is a first limited attempt to bring source code round tripping to a variety of backends, but a more general solution to the AST phase would help tooling in general So, is this worth d
Categories: Offsite Discussion

[ANN] Hayoo Relaunch

haskell-cafe - Sun, 08/03/2014 - 2:13pm
Hi Cafe, Hayoo <> has been relaunched. Hayoo is a search engine for Hackage packages, which allows you to search for functions, data types and packages. It is currently work in progress. Any feedback is greatly appreciated! Hayoo uses Hunt <> for indexing and searching, which is the successor of Holumbus. Hunt is a flexible, lightweight search platform with a powerful query language and JSON API. Example search requests are: * Function names: map <> * Function signatures: (a->b)->f a->f b <> * Module names: Control.Loop <> Have a look at the examples on <> for some advances queries. The old Hayoo and Holumbus are still online at <>
Categories: Offsite Discussion

haskell-cafe - Sun, 08/03/2014 - 1:52pm
Thinks always break on the weekend, don’t they! Apologies if this is a scheduled outtake. In the meantime, there’s fortunately a Haddock mirror on ;-) Cheers, Tim
Categories: Offsite Discussion

Haskell Platform 2014.2.0.0 Release Candidate 4(Windows only)

haskell-cafe - Sun, 08/03/2014 - 4:00am
This is an update to the Windows RC2 candidates. These candidates fix three problems with the installation scripts. The binary build of the packages has not changed. *Fixes:* - Fix the PATH to add the location where binaries are installed with "cabal install --global" - Fix the url shortcut that is installed, to point to the platform+ghc master indices, rather than just the ghc indices - Fix where a 32-bit HP installed on a 64-bit system was going *Installers can be found here:* - HaskellPlatform-2014.2.0.0-i386-RC4-setup.exe <> - HaskellPlatform-2014.2.0.0-x86_64-RC4-setup.exe <> - Mark P.S.: You might have noticed that the server that hosted the RC files was down intermittently yesterday and today. It suffered a double (!) disk failure. It is back up with shiny new disks. P.P.S: As always, for the reason
Categories: Offsite Discussion

typed tagless-final interpretation examples brokenwith recent ghc

haskell-cafe - Sat, 08/02/2014 - 4:28pm
Hi all, I've been reading up on typed tagless-final interpretations [1] and the accompanying examples. It seems the stuff about CPS transformations does no longer compile, probably because of stricter typing rules. I tried both ghc 7.6 and ghc 7.8, which both give a different kind of error message. It's a bit much and long to paste here though. I would really like to get the example working, but couldn't manage by only supplying type signatures. Perhaps there is some language pragma I can turn on or off to get the old behaviour back? The 2 files needed (no further libraries needed) are: - (working) - (problem) All help would be greatly appreciated. Regards, Mathijs [1]
Categories: Offsite Discussion

re-reading a Samson Abramsky paper ..

haskell-cafe - Sat, 08/02/2014 - 8:29am .. no words .. I will let Samson speak for himself .. :-) Hopefully my audience cam keep up with Abramsky's terseness .. he is very "cheeky" ...
Categories: Offsite Discussion

Functional programming and William Lawvere's notion of "variable sets"(vs topos of "static sets") in a Topos ...

haskell-cafe - Sat, 08/02/2014 - 7:28am
Hello Haskellers, I have been re-reading William Lawvere's description of "variable sets" (a functor category) in "a elementary topoi" on a discrete poset/preset vs a "abstract sets" in the topos of abstract sets . In Haskell( and other FPLs .. ) aren't "pure" computations just over the topos of abstract sets and "mutable" /"time-varying/stateful" computations aren't just "variable sets" (i.e. a functor over a discrete preset-poset)?? Please forgive my bad English :-( If uncertain aboyt my Englsih, please say so. Kind regards, Vasya P.S. Yes I am familiar with Eugenio Moggi's papers on using monads for stateful computations ..
Categories: Offsite Discussion