From bbcd0bf27d2663a9673983ccf6e2cf7034ddf240 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sun, 9 Aug 2020 22:17:19 +0100 Subject: Replace Prelude with RIO I believe RIO stands for: "ReaderT IO", which is a nod to the top-level application data type: ```haskell -- This is a simplification newtype RIO env a = RIO { runRIO :: ReaderT env a () } ``` I read about RIO from an FP-Complete blog post a few months ago, and now I'm excited to try it out for a real project. Bon voyage! --- website/sandbox/learnpianochords/src/server/TestUtils.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'website/sandbox/learnpianochords/src/server/TestUtils.hs') diff --git a/website/sandbox/learnpianochords/src/server/TestUtils.hs b/website/sandbox/learnpianochords/src/server/TestUtils.hs index e62950369e65..24054bf47afd 100644 --- a/website/sandbox/learnpianochords/src/server/TestUtils.hs +++ b/website/sandbox/learnpianochords/src/server/TestUtils.hs @@ -1,6 +1,7 @@ -------------------------------------------------------------------------------- module TestUtils where -------------------------------------------------------------------------------- +import RIO import Web.JWT import Data.String.Conversions (cs) -------------------------------------------------------------------------------- @@ -9,7 +10,7 @@ unsafeStringOrURI :: String -> StringOrURI unsafeStringOrURI x = case stringOrURI (cs x) of Nothing -> error $ "Failed to convert to StringOrURI: " ++ x - Just x -> x + Just res -> res unsafeJust :: Maybe a -> a unsafeJust Nothing = error "Attempted to force a Nothing to be a something" -- cgit 1.4.1