background preloader

Haskell

Facebook Twitter

Working With HTML In Haskell - adit.io. This is a complete guide to using HXT for parsing and processing HTML in Haskell. What is HXT? HXT is a collection of tools for processing XML with Haskell. It’s a complex beast, but HXT is powerful and flexible, and very elegant once you know how to use it. Why HXT? Here’s how HXT stacks up against some other XML parsers: TagSoup is the crowd favorite for HTML scraping in Haskell, but it’s a bit too basic for my needs. HXT vs HaXml HXT is based on HaXml. HXT vs hexpat hexpat is a high-performance xml parser. HXT vs xml (Text.XML.Light) I haven’t used Text.XML.Light. The one thing all these packages have in common is poor documentation. Einstein after spending several hours trying to find documentation on XML parsers Hello World To whet your appetite, here’s a simple script that uses HXT to get all links on a page: Understanding Arrows I don’t assume any prior knowledge of Arrows.

The Least You Need to Know About Arrows Arrows sound like functions! Arrow Composition With <<< and >>> Getting Started. Haskell DLL's on Windows. The current section of the GHC manual on creating DLL's on Windows is fairly confusing to read, and has some bugs (i.e. 3605). Since I got tripped up by the current documentation, I offered to rewrite sections 11.6.2 and 11.6.3 (merging them in the process). Creating Windows DLL's with GHC is surprisingly easy, and my revised manual section includes an example which can be called from both Microsoft Word (using VBA) and C++.

I've pasted the revised manual section as the rest of this blog post. I'll shortly be submitting it to the GHC team, so any feedback is welcome. 11.6.2. This section describes how to create DLLs to be called from other languages, such as Visual Basic or C++. Use foreign export declarations to export the Haskell functions you want to call from the outside. -- Adder.hs{-# LANGUAGE ForeignFunctionInterface #-}module Adder where adder :: Int -> Int -> IO Int -- gratuitous use of IOadder x y = return (x+y) foreign export stdcall adder :: Int -> Int -> IO Int 11.6.2.1. Things that amuse me. Sententia cdsmithus. Apprendre Haskell vous fera le plus grand bien ! -

Real World Haskell. Learn Me A Haskell. Introduction Haskell.