diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-28T17·46+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-28T17·47+0100 |
commit | 90a521c78f036e024454df39c3e3cd1180c90a74 (patch) | |
tree | bebdcc69bf9e525595d868829060fe05ae8e75b2 /src/Trips.hs | |
parent | 191205acaca88a059a824a2e5e22ab559293a3f1 (diff) |
Create Utils module for (|>) operator
For the past 3-4 Haskell projects on which I've worked, I've tried to habituate the usage of the (&) operator, but I find that -- as petty as it may sound -- I don't like the way that it looks, and I end up avoiding using it as a result. This time around, I'm aliasing it to (|>) (i.e. Elixir style), and I'm hoping to use it more.
Diffstat (limited to 'src/Trips.hs')
-rw-r--r-- | src/Trips.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Trips.hs b/src/Trips.hs index 0b395f8bcfe8..0d805cbe8603 100644 --- a/src/Trips.hs +++ b/src/Trips.hs @@ -2,8 +2,8 @@ -------------------------------------------------------------------------------- module Trips where -------------------------------------------------------------------------------- -import Data.Function ((&)) import Database.SQLite.Simple +import Utils import qualified Types as T -------------------------------------------------------------------------------- @@ -12,14 +12,14 @@ import qualified Types as T create :: FilePath -> T.Trip -> IO () create dbFile trip = withConnection dbFile $ \conn -> execute conn "INSERT INTO Trips (username,destination,startDate,endDate,comment) VALUES (?,?,?,?,?)" - (trip & T.tripFields) + (trip |> T.tripFields) -- | Delete a trip from `dbFile` using its `tripPK` Primary Key. delete :: FilePath -> T.TripPK -> IO () delete dbFile tripPK = withConnection dbFile $ \conn -> do execute conn "DELETE FROM Trips WHERE username = ? AND destination = ? and startDate = ?" - (tripPK & T.tripPKFields) + (tripPK |> T.tripPKFields) -- | Return a list of all of the trips in `dbFile`. list :: FilePath -> IO [T.Trip] |