about summary refs log tree commit diff
path: root/src/Types.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-28T17·46+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-28T17·47+0100
commit90a521c78f036e024454df39c3e3cd1180c90a74 (patch)
treebebdcc69bf9e525595d868829060fe05ae8e75b2 /src/Types.hs
parent191205acaca88a059a824a2e5e22ab559293a3f1 (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/Types.hs')
-rw-r--r--src/Types.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Types.hs b/src/Types.hs
index 6a474a5094bd..96cfae2c28cf 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -6,7 +6,7 @@
 module Types where
 --------------------------------------------------------------------------------
 import Data.Aeson
-import Data.Function ((&))
+import Utils
 import Data.Text
 import Data.Typeable
 import Database.SQLite.Simple
@@ -52,7 +52,7 @@ instance ToField HashedPassword where
 instance FromField HashedPassword where
   fromField field =
     case fieldData field of
-      (SQLText x) -> x & TE.encodeUtf8 & HashedPassword & Ok
+      (SQLText x) -> x |> TE.encodeUtf8 |> HashedPassword |> Ok
       _ -> returnError ConversionFailed field ""
 
 newtype ClearTextPassword = ClearTextPassword Text
@@ -314,10 +314,10 @@ instance FromJSON AccountCredentials where
                            }
 
 
--- -- | Hash password `x`.
+-- | Hash password `x`.
 hashPassword :: (MonadRandom m) => ClearTextPassword -> m HashedPassword
 hashPassword (ClearTextPassword x) = do
-  hashed <- BC.hashPassword 12 (x & unpack & B.pack)
+  hashed <- BC.hashPassword 12 (x |> unpack |> B.pack)
   pure $ HashedPassword hashed
 
 data CreateAccountRequest = CreateAccountRequest