@@ -6,7 +6,6 @@
66{-# LANGUAGE FlexibleContexts #-}
77{-# LANGUAGE FlexibleInstances #-}
88{-# LANGUAGE GADTs #-}
9−{-# LANGUAGE KindSignatures #-}
109{-# LANGUAGE LambdaCase #-}
1110{-# LANGUAGE MultiParamTypeClasses #-}
1211{-# LANGUAGE OverloadedStrings #-}
@@ -140,7 +139,6 @@ import Control.Lens
140139 , view
141140 , Wrapped (..)
142141 )
143−
144142import Control.Monad.Except
145143import qualified Control.Monad.State.Strict as State
146144import Control.Monad.Trans (lift)
@@ -154,6 +152,7 @@ import qualified Data.Dependent.Map as DMap
154152import Data.Dependent.Sum (DSum (..))
155153import Data.Either.Validation (Validation (..))
156154import Data.Foldable
155+import Data.Functor (($>))
157156import Data.Functor.Sum
158157import Data.GADT.Compare
159158import Data.GADT.Compare.TH
@@ -171,6 +170,7 @@ import Data.Text (Text)
171170import qualified Data.Text as T
172171import qualified Data.Text.Encoding as T
173172import Data.Text.Lens (IsText, packed, unpacked)
173+import Data.Type.Equality
174174import Data.Universe
175175import Data.Universe.Some
176176import Network.HTTP.Types.URI
@@ -304,13 +304,13 @@ decode e x = runIdentity (tryDecode e x)
304304-- | Once an 'Encoder' has been checked, so that its check monad has become 'Identity', even if the same is not true of the
305305-- parse monad, we may still attempt to decode with it in its parse monad.
306306tryDecode :: Encoder Identity parse decoded encoded -> encoded -> parse decoded
307−tryDecode (Encoder (Identity impl)) x = _encoderImpl_decode impl x
307+tryDecode (Encoder (Identity impl)) = _encoderImpl_decode impl
308308
309309-- | Similar to 'decode', once an encoder has been checked so that its check monad is Identity, it
310310-- can be used to actually encode by using this. Note that while there's no constraint on the parse monad here,
311311-- one should usually be applying decode and encode to the same 'Encoder'
312312encode :: Encoder Identity parse decoded encoded -> decoded -> encoded
313−encode (Encoder (Identity impl)) x = _encoderImpl_encode impl x
313+encode (Encoder (Identity impl)) = _encoderImpl_encode impl
314314
315315-- | This is a primitive used to build encoders which can't fail to check. It should not be used unless one is
316316-- reasonably certain that the law given for 'EncoderImpl' above holds.
@@ -555,11 +555,11 @@ pathComponentEncoder f = Encoder $ do
555555 unEncoder (pathComponentEncoderImpl (enum1Encoder (extractPathSegment . f)) f')
556556
557557pathComponentEncoderImpl :: forall check parse p. (Monad check, Monad parse)
558− => (Encoder check parse (Some p) (Maybe Text))
558+ => Encoder check parse (Some p) (Maybe Text)
559559 -> (forall a. p a -> Encoder Identity parse a PageName)
560560 -> Encoder check parse (R p) PageName
561−pathComponentEncoderImpl this rest =
562− chainEncoder (lensEncoder (\(_, b) a -> (a, b)) Prelude.fst consEncoder) this rest
561+pathComponentEncoderImpl =
562+ chainEncoder (lensEncoder (\(_, b) a -> (a, b)) Prelude.fst consEncoder)
563563
564564--NOTE: Naming convention in this module is to always talk about things in the *encoding* direction, never in the *decoding* direction
565565
@@ -815,7 +815,7 @@ rPrism
815815 :: forall f f'
816816 . (forall a. Prism' (f a) (f' a))
817817 -> Prism' (R f) (R f')
818−rPrism p = dSumPrism p
818+rPrism = dSumPrism
819819
820820dSumPrism'
821821 :: forall f g a
@@ -827,7 +827,7 @@ dSumGEqPrism
827827 :: GEq f
828828 => f a
829829 -> Prism' (DSum f g) (g a)
830−dSumGEqPrism variant = dSumPrism' $ prism' (\Refl -> variant) (\x -> geq variant x)
830+dSumGEqPrism variant = dSumPrism' $ prism' (\Refl -> variant) (geq variant)
831831
832832-- | Given a 'tag :: f a', make a prism for 'R f'. This generalizes the usual
833833-- prisms for a sum type (the ones that 'mkPrisms' would make), just as 'R'
@@ -994,9 +994,9 @@ obeliskRouteSegment r appRouteSegment = case r of
994994-- be combined with other such segment encoders before 'pathComponentEncoder' turns it into a proper 'Encoder'.
995995resourceRouteSegment :: (MonadError Text check, MonadError Text parse) => ResourceRoute a -> SegmentResult check parse a
996996resourceRouteSegment = \case
997− ResourceRoute_Static -> PathSegment "static" $ pathOnlyEncoderIgnoringQuery
998− ResourceRoute_Ghcjs -> PathSegment "ghcjs" $ pathOnlyEncoder
999− ResourceRoute_JSaddleWarp -> PathSegment "jsaddle" $ jsaddleWarpRouteEncoder
997+ ResourceRoute_Static -> PathSegment "static" pathOnlyEncoderIgnoringQuery
998+ ResourceRoute_Ghcjs -> PathSegment "ghcjs" pathOnlyEncoder
999+ ResourceRoute_JSaddleWarp -> PathSegment "jsaddle" jsaddleWarpRouteEncoder
10001000 ResourceRoute_Version -> PathSegment "version" $ unitEncoder mempty
10011001
10021002data JSaddleWarpRoute :: * -> * where
@@ -1008,7 +1008,7 @@ jsaddleWarpRouteEncoder :: (MonadError Text check, MonadError Text parse) => Enc
10081008jsaddleWarpRouteEncoder = pathComponentEncoder $ \case
10091009 JSaddleWarpRoute_JavaScript -> PathSegment "jsaddle.js" $ unitEncoder mempty
10101010 JSaddleWarpRoute_WebSocket -> PathEnd $ unitEncoder mempty
1011− JSaddleWarpRoute_Sync -> PathSegment "sync" $ pathOnlyEncoder
1011+ JSaddleWarpRoute_Sync -> PathSegment "sync" pathOnlyEncoder
10121012
10131013instance GShow appRoute => GShow (ObeliskRoute appRoute) where
10141014 gshowsPrec prec = \case
@@ -1039,8 +1039,8 @@ someSumEncoder = Encoder $ pure $ EncoderImpl
10391039
10401040data Void1 :: * -> * where {}
10411041
1042−instance Universe (Some Void1) where
1043− universe = []
1042+instance UniverseSome Void1 where
1043+ universeSome = []
10441044
10451045void1Encoder :: (Applicative check, MonadError Text parse) => Encoder check parse (Some Void1) a
10461046void1Encoder = Encoder $ pure $ EncoderImpl
@@ -1084,7 +1084,7 @@ readShowEncoder :: (MonadError Text parse, Read a, Show a, Applicative check) =>
10841084readShowEncoder = singlePathSegmentEncoder . unsafeTshowEncoder
10851085
10861086integralEncoder :: (MonadError Text parse, Applicative check, Integral a) => Encoder check parse a Integer
1087−integralEncoder = reviewEncoder (Numeric.Lens.integral)
1087+integralEncoder = reviewEncoder Numeric.Lens.integral
10881088
10891089pathSegmentEncoder :: (MonadError Text parse, Applicative check, Cons as as a a) =>
10901090 Encoder check parse (a, (as, b)) (as, b)
@@ -1159,7 +1159,7 @@ pathFieldEncoder fieldEncoder = unsafeEncoder $ do
11591159 fieldEncoderPure f = toEncoder (DMap.findWithDefault (error "bad") f fieldEncoderPureMap)
11601160 pure $ EncoderImpl
11611161 { _encoderImpl_encode = \(x, rest) -> execWriter $ do
1162− _ <- traverseWithField (\f x_i -> tell (pure $ encode (fieldEncoderPure f) x_i) *> pure x_i) x
1162+ _ <- traverseWithField (\f x_i -> tell (pure $ encode (fieldEncoderPure f) x_i) $> x_i) x
11631163 tell rest
11641164 , _encoderImpl_decode = State.runStateT $ tabulateFieldsA $ \f -> State.get >>= \case
11651165 [] -> throwError $ T.pack "not enough path components"