gdritter repos tansu-sqlite3 / c6f0956
Updated for the type-less version Getty Ritter 8 years ago
3 changed file(s) with 11 addition(s) and 3 deletion(s). Collapse all Expand all
5151 exec db "END TRANSACTION;"
5252 return result
5353
54 withSQLiteDb :: FilePath -> (TansuDb k v -> IO a) -> IO a
54 withSQLiteDb :: FilePath -> (TansuDb -> IO a) -> IO a
5555 withSQLiteDb path mote = do
5656 exists <- doesFileExist path
5757 conn <- open (T.pack path)
1 {-# LANGUAGE OverloadedStrings #-}
2
13 module Main where
24
35 import Control.Monad (void)
1618 putStr "looking up key 'three': "
1719 rs <- run db $ get "three"
1820 case rs of
19 Right val -> putStrLn val
21 Right val -> print val
2022 Left _ -> putStrLn "...not in the database."
2123
2224 putStr "looking up key 'five': "
2325 rs <- run db $ get "five"
2426 case rs of
25 Right val -> putStrLn val
27 Right val -> print val
2628 Left _ -> putStrLn "...not in the database."
1111 build-type: Simple
1212 cabal-version: >=1.10
1313
14 flag build-example
15 description: Build Example application
16 default: False
17
1418 library
1519 exposed-modules: Database.Tansu.Backend.SQLite3
1620 build-depends: base >=4.8 && <4.9,
2226 default-language: Haskell2010
2327
2428 executable sample
29 if !flag(build-example)
30 buildable: False
2531 main-is: Main.hs
2632 build-depends: base, tansu, tansu-sqlite3
2733 hs-source-dirs: sample