diff --git a/README.md b/README.md index 5353bb4..9d3a431 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # yore +## Inspo + +- https://fz.ub.uni-freiburg.de/show/fz.cgi?pKuerzel=FZ diff --git a/app/Main.hs b/app/Main.hs index afbc5a7..35a7094 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -9,7 +9,7 @@ import qualified Database.PostgreSQL.Opium as Opium import qualified Yore.DB main :: IO () -main = bracket (Opium.connect "host=localhost port=5432 user=yore-test dbname=yore-test") Opium.close $ \conn -> do +main = bracket unsafeConnect Opium.close $ \conn -> do result <- Yore.DB.getTables conn case result of @@ -17,3 +17,5 @@ main = bracket (Opium.connect "host=localhost port=5432 user=yore-test dbname=yo putStrLn $ "Got error: " ++ show e Right rows -> mapM_ print rows + where + unsafeConnect = either (error . show) id <$> Opium.connect "host=localhost port=5432 user=yore-test dbname=yore-test" diff --git a/flake.lock b/flake.lock index 748e442..595b378 100644 --- a/flake.lock +++ b/flake.lock @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1752614832, - "narHash": "sha256-rwLQ1xsYus6on4PSTwM2ti36Iwk5gr9lDKwFOZ451OI=", + "lastModified": 1752972533, + "narHash": "sha256-jhVfZK05aRtQ6FqLfLrhpGk8bRAkpXXXxVx4DhJgQVY=", "ref": "main", - "rev": "2fddc958b9e6b616f89570dfa44503bccd165c02", - "revCount": 59, + "rev": "b39da29d139763f41bffcc8c4c175e472d672f45", + "revCount": 61, "type": "git", "url": "https://git.pbrinkmeier.de/paul/opium" }, diff --git a/src/Yore/Download.hs b/src/Yore/Download.hs new file mode 100644 index 0000000..3ee366a --- /dev/null +++ b/src/Yore/Download.hs @@ -0,0 +1 @@ +module Yore.Download () where diff --git a/src/Yore/Repl.hs b/src/Yore/Repl.hs index bd677d8..ae78a02 100644 --- a/src/Yore/Repl.hs +++ b/src/Yore/Repl.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module Yore.Repl (connect, exec) where @@ -5,7 +6,10 @@ module Yore.Repl (connect, exec) where import qualified Database.PostgreSQL.Opium as Opium connect :: IO Opium.Connection -connect = Opium.connect "host=localhost" +connect = + Opium.connect "host=localhost" >>= \case + Left e -> error $ show e + Right c -> pure c exec :: (Opium.Connection -> IO a) -> IO a exec f = f =<< connect diff --git a/yore.cabal b/yore.cabal index 8fcae2b..629f71a 100644 --- a/yore.cabal +++ b/yore.cabal @@ -33,6 +33,7 @@ library exposed-modules: Yore.DB , Yore.Repl + , Yore.Download hs-source-dirs: src build-depends: