Created
January 30, 2014 13:44
-
-
Save snowmantw/8708585 to your computer and use it in GitHub Desktop.
Haskell and map/reduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE UnicodeSyntax #-} | |
-- Pardon me. Crying for the missing lambda charater on the keybord. | |
-- Let's construct queries from SQL statements. | |
makeQueries strs = map λstr → prepare conn str | |
doQuery qrys = foldl (λresults query → results >> query) (return ()) qrys | |
-- Do query and get results. | |
let stmts = [ "INSERT INTO Articles ('Functional JavaScript')" | |
, "INSERT INTO Gecko VALUES ('30.a1')" | |
, "DELETE FROM Articles WHERE version='deprecated'" | |
] | |
main = execute (doQuery (makeQuery stmts)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment