Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 861 Bytes

File metadata and controls

36 lines (28 loc) · 861 Bytes

Create src/Persistence/Red.hs

Config part

Edit cabal file

[...]
library
  hs-source-dirs:      src
  exposed-modules:     Lib
                      ,Persistence.Red

  build-depends:       base >= 4.7 && < 5
                      , mtl
                      , hedis
                      , bytestring
[...]                      

Install redis on your environment and run redis-server inside a terminal instance (to handle different terminal sessions you can use Terminator on linux systems, I use iTerm on Mac)

 $ redis-server

Code part

Hedis provide a 1:1 API from haskell to redis. Its functions, normally, return data "wrapped" inside IO Monad, in order to use them inside handlers we exploit lift function, we leverage on MonadTransformers, namely HandlerT

  gmap' <- lift (Red.getMapJsonById team)