Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created August 15, 2013 04:29
Show Gist options
  • Save mxswd/6238269 to your computer and use it in GitHub Desktop.
Save mxswd/6238269 to your computer and use it in GitHub Desktop.
newtype ActionM a = AM { runAM :: ErrorT ActionError (ReaderT ActionEnv (StateT Response IO)) a }
deriving ( Monad, MonadIO, Functor
, MonadReader ActionEnv, MonadState Response, MonadError ActionError)
-- backend
get :: B.Connection -> L.Text -> ActionM (Maybe L.Text)
get b k = do
let code = ensureUrl k
val <- B.get b (c_of code)
case val of
Left e -> raise "RedisError"
Right v -> return v
-- frontend
get (regex "^\\/([A-Za-z0-9+\\/=]*)$") $ do
code <- S.escape <$> param "1"
url <- S.get backend code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment