{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveLift #-}
module Yesod.Routes.TH.Types
(
Resource (..)
, ResourceTree (..)
, Piece (..)
, Dispatch (..)
, CheckOverlap
, FlatResource (..)
, ParentDetails (..)
, TyArgs (..)
, toTyArgs
, tyArgsList
, tyArgsTypes
, tyArgsBinders
, tyArgsArity
, hasTyArgs
, applyTyArgs
, resourceMulti
, resourceTreePieces
, resourceTreeName
, flatten
) where
import Language.Haskell.TH.Syntax
import Data.List (foldl')
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NonEmpty
import Data.Set (Set)
import Instances.TH.Lift ()
data TyArgs
= NoTyArgs
| SomeTyArgs (NonEmpty (Type, Name))
deriving (TyArgs -> TyArgs -> Bool
(TyArgs -> TyArgs -> Bool)
-> (TyArgs -> TyArgs -> Bool) -> Eq TyArgs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TyArgs -> TyArgs -> Bool
== :: TyArgs -> TyArgs -> Bool
$c/= :: TyArgs -> TyArgs -> Bool
/= :: TyArgs -> TyArgs -> Bool
Eq, Int -> TyArgs -> ShowS
[TyArgs] -> ShowS
TyArgs -> String
(Int -> TyArgs -> ShowS)
-> (TyArgs -> String) -> ([TyArgs] -> ShowS) -> Show TyArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TyArgs -> ShowS
showsPrec :: Int -> TyArgs -> ShowS
$cshow :: TyArgs -> String
show :: TyArgs -> String
$cshowList :: [TyArgs] -> ShowS
showList :: [TyArgs] -> ShowS
Show)
toTyArgs :: [(Type, Name)] -> TyArgs
toTyArgs :: [(Type, Name)] -> TyArgs
toTyArgs [] = TyArgs
NoTyArgs
toTyArgs ((Type, Name)
x : [(Type, Name)]
xs) = NonEmpty (Type, Name) -> TyArgs
SomeTyArgs ((Type, Name)
x (Type, Name) -> [(Type, Name)] -> NonEmpty (Type, Name)
forall a. a -> [a] -> NonEmpty a
:| [(Type, Name)]
xs)
tyArgsList :: TyArgs -> [(Type, Name)]
tyArgsList :: TyArgs -> [(Type, Name)]
tyArgsList TyArgs
NoTyArgs = []
tyArgsList (SomeTyArgs NonEmpty (Type, Name)
ne) = NonEmpty (Type, Name) -> [(Type, Name)]
forall a. NonEmpty a -> [a]
NonEmpty.toList NonEmpty (Type, Name)
ne
tyArgsTypes :: TyArgs -> [Type]
tyArgsTypes :: TyArgs -> [Type]
tyArgsTypes = ((Type, Name) -> Type) -> [(Type, Name)] -> [Type]
forall a b. (a -> b) -> [a] -> [b]
map (Type, Name) -> Type
forall a b. (a, b) -> a
fst ([(Type, Name)] -> [Type])
-> (TyArgs -> [(Type, Name)]) -> TyArgs -> [Type]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyArgs -> [(Type, Name)]
tyArgsList
tyArgsBinders :: TyArgs -> [Name]
tyArgsBinders :: TyArgs -> [Name]
tyArgsBinders = ((Type, Name) -> Name) -> [(Type, Name)] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (Type, Name) -> Name
forall a b. (a, b) -> b
snd ([(Type, Name)] -> [Name])
-> (TyArgs -> [(Type, Name)]) -> TyArgs -> [Name]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyArgs -> [(Type, Name)]
tyArgsList
tyArgsArity :: TyArgs -> Int
tyArgsArity :: TyArgs -> Int
tyArgsArity TyArgs
NoTyArgs = Int
0
tyArgsArity (SomeTyArgs NonEmpty (Type, Name)
ne) = NonEmpty (Type, Name) -> Int
forall a. NonEmpty a -> Int
NonEmpty.length NonEmpty (Type, Name)
ne
hasTyArgs :: TyArgs -> Bool
hasTyArgs :: TyArgs -> Bool
hasTyArgs TyArgs
NoTyArgs = Bool
False
hasTyArgs SomeTyArgs {} = Bool
True
applyTyArgs :: Type -> TyArgs -> Type
applyTyArgs :: Type -> TyArgs -> Type
applyTyArgs Type
t = (Type -> Type -> Type) -> Type -> [Type] -> Type
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' Type -> Type -> Type
AppT Type
t ([Type] -> Type) -> (TyArgs -> [Type]) -> TyArgs -> Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyArgs -> [Type]
tyArgsTypes
data ResourceTree typ
= ResourceLeaf (Resource typ)
| ResourceParent String CheckOverlap (Set String) [Piece typ] [ResourceTree typ]
deriving ((forall (m :: * -> *). Quote m => ResourceTree typ -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
ResourceTree typ -> Code m (ResourceTree typ))
-> Lift (ResourceTree typ)
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
ResourceTree typ -> m Exp
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
ResourceTree typ -> Code m (ResourceTree typ)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => ResourceTree typ -> m Exp
forall (m :: * -> *).
Quote m =>
ResourceTree typ -> Code m (ResourceTree typ)
$clift :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
ResourceTree typ -> m Exp
lift :: forall (m :: * -> *). Quote m => ResourceTree typ -> m Exp
$cliftTyped :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
ResourceTree typ -> Code m (ResourceTree typ)
liftTyped :: forall (m :: * -> *).
Quote m =>
ResourceTree typ -> Code m (ResourceTree typ)
Lift, Int -> ResourceTree typ -> ShowS
[ResourceTree typ] -> ShowS
ResourceTree typ -> String
(Int -> ResourceTree typ -> ShowS)
-> (ResourceTree typ -> String)
-> ([ResourceTree typ] -> ShowS)
-> Show (ResourceTree typ)
forall typ. Show typ => Int -> ResourceTree typ -> ShowS
forall typ. Show typ => [ResourceTree typ] -> ShowS
forall typ. Show typ => ResourceTree typ -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall typ. Show typ => Int -> ResourceTree typ -> ShowS
showsPrec :: Int -> ResourceTree typ -> ShowS
$cshow :: forall typ. Show typ => ResourceTree typ -> String
show :: ResourceTree typ -> String
$cshowList :: forall typ. Show typ => [ResourceTree typ] -> ShowS
showList :: [ResourceTree typ] -> ShowS
Show, (forall a b. (a -> b) -> ResourceTree a -> ResourceTree b)
-> (forall a b. a -> ResourceTree b -> ResourceTree a)
-> Functor ResourceTree
forall a b. a -> ResourceTree b -> ResourceTree a
forall a b. (a -> b) -> ResourceTree a -> ResourceTree b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> ResourceTree a -> ResourceTree b
fmap :: forall a b. (a -> b) -> ResourceTree a -> ResourceTree b
$c<$ :: forall a b. a -> ResourceTree b -> ResourceTree a
<$ :: forall a b. a -> ResourceTree b -> ResourceTree a
Functor, (forall m. Monoid m => ResourceTree m -> m)
-> (forall m a. Monoid m => (a -> m) -> ResourceTree a -> m)
-> (forall m a. Monoid m => (a -> m) -> ResourceTree a -> m)
-> (forall a b. (a -> b -> b) -> b -> ResourceTree a -> b)
-> (forall a b. (a -> b -> b) -> b -> ResourceTree a -> b)
-> (forall b a. (b -> a -> b) -> b -> ResourceTree a -> b)
-> (forall b a. (b -> a -> b) -> b -> ResourceTree a -> b)
-> (forall a. (a -> a -> a) -> ResourceTree a -> a)
-> (forall a. (a -> a -> a) -> ResourceTree a -> a)
-> (forall a. ResourceTree a -> [a])
-> (forall a. ResourceTree a -> Bool)
-> (forall a. ResourceTree a -> Int)
-> (forall a. Eq a => a -> ResourceTree a -> Bool)
-> (forall a. Ord a => ResourceTree a -> a)
-> (forall a. Ord a => ResourceTree a -> a)
-> (forall a. Num a => ResourceTree a -> a)
-> (forall a. Num a => ResourceTree a -> a)
-> Foldable ResourceTree
forall a. Eq a => a -> ResourceTree a -> Bool
forall a. Num a => ResourceTree a -> a
forall a. Ord a => ResourceTree a -> a
forall m. Monoid m => ResourceTree m -> m
forall a. ResourceTree a -> Bool
forall a. ResourceTree a -> Int
forall a. ResourceTree a -> [a]
forall a. (a -> a -> a) -> ResourceTree a -> a
forall m a. Monoid m => (a -> m) -> ResourceTree a -> m
forall b a. (b -> a -> b) -> b -> ResourceTree a -> b
forall a b. (a -> b -> b) -> b -> ResourceTree a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => ResourceTree m -> m
fold :: forall m. Monoid m => ResourceTree m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> ResourceTree a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ResourceTree a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> ResourceTree a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ResourceTree a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> ResourceTree a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ResourceTree a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> ResourceTree a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ResourceTree a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> ResourceTree a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ResourceTree a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> ResourceTree a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ResourceTree a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> ResourceTree a -> a
foldr1 :: forall a. (a -> a -> a) -> ResourceTree a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> ResourceTree a -> a
foldl1 :: forall a. (a -> a -> a) -> ResourceTree a -> a
$ctoList :: forall a. ResourceTree a -> [a]
toList :: forall a. ResourceTree a -> [a]
$cnull :: forall a. ResourceTree a -> Bool
null :: forall a. ResourceTree a -> Bool
$clength :: forall a. ResourceTree a -> Int
length :: forall a. ResourceTree a -> Int
$celem :: forall a. Eq a => a -> ResourceTree a -> Bool
elem :: forall a. Eq a => a -> ResourceTree a -> Bool
$cmaximum :: forall a. Ord a => ResourceTree a -> a
maximum :: forall a. Ord a => ResourceTree a -> a
$cminimum :: forall a. Ord a => ResourceTree a -> a
minimum :: forall a. Ord a => ResourceTree a -> a
$csum :: forall a. Num a => ResourceTree a -> a
sum :: forall a. Num a => ResourceTree a -> a
$cproduct :: forall a. Num a => ResourceTree a -> a
product :: forall a. Num a => ResourceTree a -> a
Foldable, Functor ResourceTree
Foldable ResourceTree
(Functor ResourceTree, Foldable ResourceTree) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ResourceTree a -> f (ResourceTree b))
-> (forall (f :: * -> *) a.
Applicative f =>
ResourceTree (f a) -> f (ResourceTree a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ResourceTree a -> m (ResourceTree b))
-> (forall (m :: * -> *) a.
Monad m =>
ResourceTree (m a) -> m (ResourceTree a))
-> Traversable ResourceTree
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ResourceTree (m a) -> m (ResourceTree a)
forall (f :: * -> *) a.
Applicative f =>
ResourceTree (f a) -> f (ResourceTree a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ResourceTree a -> m (ResourceTree b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ResourceTree a -> f (ResourceTree b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ResourceTree a -> f (ResourceTree b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ResourceTree a -> f (ResourceTree b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
ResourceTree (f a) -> f (ResourceTree a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ResourceTree (f a) -> f (ResourceTree a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ResourceTree a -> m (ResourceTree b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ResourceTree a -> m (ResourceTree b)
$csequence :: forall (m :: * -> *) a.
Monad m =>
ResourceTree (m a) -> m (ResourceTree a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ResourceTree (m a) -> m (ResourceTree a)
Traversable)
resourceTreePieces :: ResourceTree typ -> [Piece typ]
resourceTreePieces :: forall typ. ResourceTree typ -> [Piece typ]
resourceTreePieces (ResourceLeaf Resource typ
r) = Resource typ -> [Piece typ]
forall typ. Resource typ -> [Piece typ]
resourcePieces Resource typ
r
resourceTreePieces (ResourceParent String
_ Bool
_ Set String
_ [Piece typ]
x [ResourceTree typ]
_) = [Piece typ]
x
resourceTreeName :: ResourceTree typ -> String
resourceTreeName :: forall typ. ResourceTree typ -> String
resourceTreeName (ResourceLeaf Resource typ
r) = Resource typ -> String
forall typ. Resource typ -> String
resourceName Resource typ
r
resourceTreeName (ResourceParent String
x Bool
_ Set String
_ [Piece typ]
_ [ResourceTree typ]
_) = String
x
data Resource typ = Resource
{ forall typ. Resource typ -> String
resourceName :: String
, forall typ. Resource typ -> [Piece typ]
resourcePieces :: [Piece typ]
, forall typ. Resource typ -> Dispatch typ
resourceDispatch :: Dispatch typ
, forall typ. Resource typ -> [String]
resourceAttrs :: [String]
, forall typ. Resource typ -> Bool
resourceCheck :: CheckOverlap
}
deriving ((forall (m :: * -> *). Quote m => Resource typ -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
Resource typ -> Code m (Resource typ))
-> Lift (Resource typ)
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Resource typ -> m Exp
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Resource typ -> Code m (Resource typ)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Resource typ -> m Exp
forall (m :: * -> *).
Quote m =>
Resource typ -> Code m (Resource typ)
$clift :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Resource typ -> m Exp
lift :: forall (m :: * -> *). Quote m => Resource typ -> m Exp
$cliftTyped :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Resource typ -> Code m (Resource typ)
liftTyped :: forall (m :: * -> *).
Quote m =>
Resource typ -> Code m (Resource typ)
Lift, Int -> Resource typ -> ShowS
[Resource typ] -> ShowS
Resource typ -> String
(Int -> Resource typ -> ShowS)
-> (Resource typ -> String)
-> ([Resource typ] -> ShowS)
-> Show (Resource typ)
forall typ. Show typ => Int -> Resource typ -> ShowS
forall typ. Show typ => [Resource typ] -> ShowS
forall typ. Show typ => Resource typ -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall typ. Show typ => Int -> Resource typ -> ShowS
showsPrec :: Int -> Resource typ -> ShowS
$cshow :: forall typ. Show typ => Resource typ -> String
show :: Resource typ -> String
$cshowList :: forall typ. Show typ => [Resource typ] -> ShowS
showList :: [Resource typ] -> ShowS
Show, (forall a b. (a -> b) -> Resource a -> Resource b)
-> (forall a b. a -> Resource b -> Resource a) -> Functor Resource
forall a b. a -> Resource b -> Resource a
forall a b. (a -> b) -> Resource a -> Resource b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Resource a -> Resource b
fmap :: forall a b. (a -> b) -> Resource a -> Resource b
$c<$ :: forall a b. a -> Resource b -> Resource a
<$ :: forall a b. a -> Resource b -> Resource a
Functor, (forall m. Monoid m => Resource m -> m)
-> (forall m a. Monoid m => (a -> m) -> Resource a -> m)
-> (forall m a. Monoid m => (a -> m) -> Resource a -> m)
-> (forall a b. (a -> b -> b) -> b -> Resource a -> b)
-> (forall a b. (a -> b -> b) -> b -> Resource a -> b)
-> (forall b a. (b -> a -> b) -> b -> Resource a -> b)
-> (forall b a. (b -> a -> b) -> b -> Resource a -> b)
-> (forall a. (a -> a -> a) -> Resource a -> a)
-> (forall a. (a -> a -> a) -> Resource a -> a)
-> (forall a. Resource a -> [a])
-> (forall typ. Resource typ -> Bool)
-> (forall a. Resource a -> Int)
-> (forall a. Eq a => a -> Resource a -> Bool)
-> (forall a. Ord a => Resource a -> a)
-> (forall a. Ord a => Resource a -> a)
-> (forall a. Num a => Resource a -> a)
-> (forall a. Num a => Resource a -> a)
-> Foldable Resource
forall a. Eq a => a -> Resource a -> Bool
forall a. Num a => Resource a -> a
forall a. Ord a => Resource a -> a
forall m. Monoid m => Resource m -> m
forall typ. Resource typ -> Bool
forall a. Resource a -> Int
forall a. Resource a -> [a]
forall a. (a -> a -> a) -> Resource a -> a
forall m a. Monoid m => (a -> m) -> Resource a -> m
forall b a. (b -> a -> b) -> b -> Resource a -> b
forall a b. (a -> b -> b) -> b -> Resource a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Resource m -> m
fold :: forall m. Monoid m => Resource m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Resource a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Resource a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Resource a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Resource a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Resource a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Resource a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Resource a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Resource a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Resource a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Resource a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Resource a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Resource a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Resource a -> a
foldr1 :: forall a. (a -> a -> a) -> Resource a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Resource a -> a
foldl1 :: forall a. (a -> a -> a) -> Resource a -> a
$ctoList :: forall a. Resource a -> [a]
toList :: forall a. Resource a -> [a]
$cnull :: forall typ. Resource typ -> Bool
null :: forall typ. Resource typ -> Bool
$clength :: forall a. Resource a -> Int
length :: forall a. Resource a -> Int
$celem :: forall a. Eq a => a -> Resource a -> Bool
elem :: forall a. Eq a => a -> Resource a -> Bool
$cmaximum :: forall a. Ord a => Resource a -> a
maximum :: forall a. Ord a => Resource a -> a
$cminimum :: forall a. Ord a => Resource a -> a
minimum :: forall a. Ord a => Resource a -> a
$csum :: forall a. Num a => Resource a -> a
sum :: forall a. Num a => Resource a -> a
$cproduct :: forall a. Num a => Resource a -> a
product :: forall a. Num a => Resource a -> a
Foldable, Functor Resource
Foldable Resource
(Functor Resource, Foldable Resource) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Resource a -> f (Resource b))
-> (forall (f :: * -> *) a.
Applicative f =>
Resource (f a) -> f (Resource a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Resource a -> m (Resource b))
-> (forall (m :: * -> *) a.
Monad m =>
Resource (m a) -> m (Resource a))
-> Traversable Resource
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Resource (m a) -> m (Resource a)
forall (f :: * -> *) a.
Applicative f =>
Resource (f a) -> f (Resource a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Resource a -> m (Resource b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Resource a -> f (Resource b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Resource a -> f (Resource b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Resource a -> f (Resource b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Resource (f a) -> f (Resource a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Resource (f a) -> f (Resource a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Resource a -> m (Resource b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Resource a -> m (Resource b)
$csequence :: forall (m :: * -> *) a. Monad m => Resource (m a) -> m (Resource a)
sequence :: forall (m :: * -> *) a. Monad m => Resource (m a) -> m (Resource a)
Traversable)
type CheckOverlap = Bool
data Piece typ = Static String | Dynamic typ
deriving ((forall (m :: * -> *). Quote m => Piece typ -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
Piece typ -> Code m (Piece typ))
-> Lift (Piece typ)
forall typ (m :: * -> *). (Lift typ, Quote m) => Piece typ -> m Exp
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Piece typ -> Code m (Piece typ)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Piece typ -> m Exp
forall (m :: * -> *). Quote m => Piece typ -> Code m (Piece typ)
$clift :: forall typ (m :: * -> *). (Lift typ, Quote m) => Piece typ -> m Exp
lift :: forall (m :: * -> *). Quote m => Piece typ -> m Exp
$cliftTyped :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Piece typ -> Code m (Piece typ)
liftTyped :: forall (m :: * -> *). Quote m => Piece typ -> Code m (Piece typ)
Lift, Int -> Piece typ -> ShowS
[Piece typ] -> ShowS
Piece typ -> String
(Int -> Piece typ -> ShowS)
-> (Piece typ -> String)
-> ([Piece typ] -> ShowS)
-> Show (Piece typ)
forall typ. Show typ => Int -> Piece typ -> ShowS
forall typ. Show typ => [Piece typ] -> ShowS
forall typ. Show typ => Piece typ -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall typ. Show typ => Int -> Piece typ -> ShowS
showsPrec :: Int -> Piece typ -> ShowS
$cshow :: forall typ. Show typ => Piece typ -> String
show :: Piece typ -> String
$cshowList :: forall typ. Show typ => [Piece typ] -> ShowS
showList :: [Piece typ] -> ShowS
Show, (forall a b. (a -> b) -> Piece a -> Piece b)
-> (forall a b. a -> Piece b -> Piece a) -> Functor Piece
forall a b. a -> Piece b -> Piece a
forall a b. (a -> b) -> Piece a -> Piece b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Piece a -> Piece b
fmap :: forall a b. (a -> b) -> Piece a -> Piece b
$c<$ :: forall a b. a -> Piece b -> Piece a
<$ :: forall a b. a -> Piece b -> Piece a
Functor, (forall m. Monoid m => Piece m -> m)
-> (forall m a. Monoid m => (a -> m) -> Piece a -> m)
-> (forall m a. Monoid m => (a -> m) -> Piece a -> m)
-> (forall a b. (a -> b -> b) -> b -> Piece a -> b)
-> (forall a b. (a -> b -> b) -> b -> Piece a -> b)
-> (forall b a. (b -> a -> b) -> b -> Piece a -> b)
-> (forall b a. (b -> a -> b) -> b -> Piece a -> b)
-> (forall a. (a -> a -> a) -> Piece a -> a)
-> (forall a. (a -> a -> a) -> Piece a -> a)
-> (forall a. Piece a -> [a])
-> (forall a. Piece a -> Bool)
-> (forall a. Piece a -> Int)
-> (forall a. Eq a => a -> Piece a -> Bool)
-> (forall a. Ord a => Piece a -> a)
-> (forall a. Ord a => Piece a -> a)
-> (forall a. Num a => Piece a -> a)
-> (forall a. Num a => Piece a -> a)
-> Foldable Piece
forall a. Eq a => a -> Piece a -> Bool
forall a. Num a => Piece a -> a
forall a. Ord a => Piece a -> a
forall m. Monoid m => Piece m -> m
forall a. Piece a -> Bool
forall a. Piece a -> Int
forall a. Piece a -> [a]
forall a. (a -> a -> a) -> Piece a -> a
forall m a. Monoid m => (a -> m) -> Piece a -> m
forall b a. (b -> a -> b) -> b -> Piece a -> b
forall a b. (a -> b -> b) -> b -> Piece a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Piece m -> m
fold :: forall m. Monoid m => Piece m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Piece a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Piece a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Piece a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Piece a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Piece a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Piece a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Piece a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Piece a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Piece a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Piece a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Piece a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Piece a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Piece a -> a
foldr1 :: forall a. (a -> a -> a) -> Piece a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Piece a -> a
foldl1 :: forall a. (a -> a -> a) -> Piece a -> a
$ctoList :: forall a. Piece a -> [a]
toList :: forall a. Piece a -> [a]
$cnull :: forall a. Piece a -> Bool
null :: forall a. Piece a -> Bool
$clength :: forall a. Piece a -> Int
length :: forall a. Piece a -> Int
$celem :: forall a. Eq a => a -> Piece a -> Bool
elem :: forall a. Eq a => a -> Piece a -> Bool
$cmaximum :: forall a. Ord a => Piece a -> a
maximum :: forall a. Ord a => Piece a -> a
$cminimum :: forall a. Ord a => Piece a -> a
minimum :: forall a. Ord a => Piece a -> a
$csum :: forall a. Num a => Piece a -> a
sum :: forall a. Num a => Piece a -> a
$cproduct :: forall a. Num a => Piece a -> a
product :: forall a. Num a => Piece a -> a
Foldable, Functor Piece
Foldable Piece
(Functor Piece, Foldable Piece) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Piece a -> f (Piece b))
-> (forall (f :: * -> *) a.
Applicative f =>
Piece (f a) -> f (Piece a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Piece a -> m (Piece b))
-> (forall (m :: * -> *) a. Monad m => Piece (m a) -> m (Piece a))
-> Traversable Piece
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Piece (m a) -> m (Piece a)
forall (f :: * -> *) a. Applicative f => Piece (f a) -> f (Piece a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Piece a -> m (Piece b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Piece a -> f (Piece b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Piece a -> f (Piece b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Piece a -> f (Piece b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Piece (f a) -> f (Piece a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Piece (f a) -> f (Piece a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Piece a -> m (Piece b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Piece a -> m (Piece b)
$csequence :: forall (m :: * -> *) a. Monad m => Piece (m a) -> m (Piece a)
sequence :: forall (m :: * -> *) a. Monad m => Piece (m a) -> m (Piece a)
Traversable)
data Dispatch typ =
Methods
{ forall typ. Dispatch typ -> Maybe typ
methodsMulti :: Maybe typ
, forall typ. Dispatch typ -> [String]
methodsMethods :: [String]
}
| Subsite
{ forall typ. Dispatch typ -> typ
subsiteType :: typ
, forall typ. Dispatch typ -> String
subsiteFunc :: String
}
deriving ((forall (m :: * -> *). Quote m => Dispatch typ -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
Dispatch typ -> Code m (Dispatch typ))
-> Lift (Dispatch typ)
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Dispatch typ -> m Exp
forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Dispatch typ -> Code m (Dispatch typ)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Dispatch typ -> m Exp
forall (m :: * -> *).
Quote m =>
Dispatch typ -> Code m (Dispatch typ)
$clift :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Dispatch typ -> m Exp
lift :: forall (m :: * -> *). Quote m => Dispatch typ -> m Exp
$cliftTyped :: forall typ (m :: * -> *).
(Lift typ, Quote m) =>
Dispatch typ -> Code m (Dispatch typ)
liftTyped :: forall (m :: * -> *).
Quote m =>
Dispatch typ -> Code m (Dispatch typ)
Lift, Int -> Dispatch typ -> ShowS
[Dispatch typ] -> ShowS
Dispatch typ -> String
(Int -> Dispatch typ -> ShowS)
-> (Dispatch typ -> String)
-> ([Dispatch typ] -> ShowS)
-> Show (Dispatch typ)
forall typ. Show typ => Int -> Dispatch typ -> ShowS
forall typ. Show typ => [Dispatch typ] -> ShowS
forall typ. Show typ => Dispatch typ -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall typ. Show typ => Int -> Dispatch typ -> ShowS
showsPrec :: Int -> Dispatch typ -> ShowS
$cshow :: forall typ. Show typ => Dispatch typ -> String
show :: Dispatch typ -> String
$cshowList :: forall typ. Show typ => [Dispatch typ] -> ShowS
showList :: [Dispatch typ] -> ShowS
Show, (forall a b. (a -> b) -> Dispatch a -> Dispatch b)
-> (forall a b. a -> Dispatch b -> Dispatch a) -> Functor Dispatch
forall a b. a -> Dispatch b -> Dispatch a
forall a b. (a -> b) -> Dispatch a -> Dispatch b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Dispatch a -> Dispatch b
fmap :: forall a b. (a -> b) -> Dispatch a -> Dispatch b
$c<$ :: forall a b. a -> Dispatch b -> Dispatch a
<$ :: forall a b. a -> Dispatch b -> Dispatch a
Functor, (forall m. Monoid m => Dispatch m -> m)
-> (forall m a. Monoid m => (a -> m) -> Dispatch a -> m)
-> (forall m a. Monoid m => (a -> m) -> Dispatch a -> m)
-> (forall a b. (a -> b -> b) -> b -> Dispatch a -> b)
-> (forall a b. (a -> b -> b) -> b -> Dispatch a -> b)
-> (forall b a. (b -> a -> b) -> b -> Dispatch a -> b)
-> (forall b a. (b -> a -> b) -> b -> Dispatch a -> b)
-> (forall a. (a -> a -> a) -> Dispatch a -> a)
-> (forall a. (a -> a -> a) -> Dispatch a -> a)
-> (forall a. Dispatch a -> [a])
-> (forall a. Dispatch a -> Bool)
-> (forall a. Dispatch a -> Int)
-> (forall a. Eq a => a -> Dispatch a -> Bool)
-> (forall a. Ord a => Dispatch a -> a)
-> (forall a. Ord a => Dispatch a -> a)
-> (forall a. Num a => Dispatch a -> a)
-> (forall a. Num a => Dispatch a -> a)
-> Foldable Dispatch
forall a. Eq a => a -> Dispatch a -> Bool
forall a. Num a => Dispatch a -> a
forall a. Ord a => Dispatch a -> a
forall m. Monoid m => Dispatch m -> m
forall a. Dispatch a -> Bool
forall a. Dispatch a -> Int
forall a. Dispatch a -> [a]
forall a. (a -> a -> a) -> Dispatch a -> a
forall m a. Monoid m => (a -> m) -> Dispatch a -> m
forall b a. (b -> a -> b) -> b -> Dispatch a -> b
forall a b. (a -> b -> b) -> b -> Dispatch a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Dispatch m -> m
fold :: forall m. Monoid m => Dispatch m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Dispatch a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Dispatch a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Dispatch a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Dispatch a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Dispatch a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Dispatch a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Dispatch a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Dispatch a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Dispatch a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Dispatch a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Dispatch a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Dispatch a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Dispatch a -> a
foldr1 :: forall a. (a -> a -> a) -> Dispatch a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Dispatch a -> a
foldl1 :: forall a. (a -> a -> a) -> Dispatch a -> a
$ctoList :: forall a. Dispatch a -> [a]
toList :: forall a. Dispatch a -> [a]
$cnull :: forall a. Dispatch a -> Bool
null :: forall a. Dispatch a -> Bool
$clength :: forall a. Dispatch a -> Int
length :: forall a. Dispatch a -> Int
$celem :: forall a. Eq a => a -> Dispatch a -> Bool
elem :: forall a. Eq a => a -> Dispatch a -> Bool
$cmaximum :: forall a. Ord a => Dispatch a -> a
maximum :: forall a. Ord a => Dispatch a -> a
$cminimum :: forall a. Ord a => Dispatch a -> a
minimum :: forall a. Ord a => Dispatch a -> a
$csum :: forall a. Num a => Dispatch a -> a
sum :: forall a. Num a => Dispatch a -> a
$cproduct :: forall a. Num a => Dispatch a -> a
product :: forall a. Num a => Dispatch a -> a
Foldable, Functor Dispatch
Foldable Dispatch
(Functor Dispatch, Foldable Dispatch) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Dispatch a -> f (Dispatch b))
-> (forall (f :: * -> *) a.
Applicative f =>
Dispatch (f a) -> f (Dispatch a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Dispatch a -> m (Dispatch b))
-> (forall (m :: * -> *) a.
Monad m =>
Dispatch (m a) -> m (Dispatch a))
-> Traversable Dispatch
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Dispatch (m a) -> m (Dispatch a)
forall (f :: * -> *) a.
Applicative f =>
Dispatch (f a) -> f (Dispatch a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Dispatch a -> m (Dispatch b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Dispatch a -> f (Dispatch b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Dispatch a -> f (Dispatch b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Dispatch a -> f (Dispatch b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Dispatch (f a) -> f (Dispatch a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Dispatch (f a) -> f (Dispatch a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Dispatch a -> m (Dispatch b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Dispatch a -> m (Dispatch b)
$csequence :: forall (m :: * -> *) a. Monad m => Dispatch (m a) -> m (Dispatch a)
sequence :: forall (m :: * -> *) a. Monad m => Dispatch (m a) -> m (Dispatch a)
Traversable)
resourceMulti :: Resource typ -> Maybe typ
resourceMulti :: forall typ. Resource typ -> Maybe typ
resourceMulti Resource { resourceDispatch :: forall typ. Resource typ -> Dispatch typ
resourceDispatch = Methods (Just typ
t) [String]
_ } = typ -> Maybe typ
forall a. a -> Maybe a
Just typ
t
resourceMulti Resource typ
_ = Maybe typ
forall a. Maybe a
Nothing
data ParentDetails a = ParentDetails
{ forall a. ParentDetails a -> String
pdName :: String
, forall a. ParentDetails a -> [Piece a]
pdPieces :: [Piece a]
, forall a. ParentDetails a -> Set String
pdAttrs :: Set String
} deriving (Int -> ParentDetails a -> ShowS
[ParentDetails a] -> ShowS
ParentDetails a -> String
(Int -> ParentDetails a -> ShowS)
-> (ParentDetails a -> String)
-> ([ParentDetails a] -> ShowS)
-> Show (ParentDetails a)
forall a. Show a => Int -> ParentDetails a -> ShowS
forall a. Show a => [ParentDetails a] -> ShowS
forall a. Show a => ParentDetails a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> ParentDetails a -> ShowS
showsPrec :: Int -> ParentDetails a -> ShowS
$cshow :: forall a. Show a => ParentDetails a -> String
show :: ParentDetails a -> String
$cshowList :: forall a. Show a => [ParentDetails a] -> ShowS
showList :: [ParentDetails a] -> ShowS
Show)
data FlatResource a = FlatResource
{ forall a. FlatResource a -> [ParentDetails a]
frParentDetails :: [ParentDetails a]
, forall a. FlatResource a -> String
frName :: String
, forall a. FlatResource a -> [Piece a]
frPieces :: [Piece a]
, forall a. FlatResource a -> Dispatch a
frDispatch :: Dispatch a
, forall a. FlatResource a -> Bool
frCheck :: Bool
} deriving (Int -> FlatResource a -> ShowS
[FlatResource a] -> ShowS
FlatResource a -> String
(Int -> FlatResource a -> ShowS)
-> (FlatResource a -> String)
-> ([FlatResource a] -> ShowS)
-> Show (FlatResource a)
forall a. Show a => Int -> FlatResource a -> ShowS
forall a. Show a => [FlatResource a] -> ShowS
forall a. Show a => FlatResource a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> FlatResource a -> ShowS
showsPrec :: Int -> FlatResource a -> ShowS
$cshow :: forall a. Show a => FlatResource a -> String
show :: FlatResource a -> String
$cshowList :: forall a. Show a => [FlatResource a] -> ShowS
showList :: [FlatResource a] -> ShowS
Show)
flatten :: [ResourceTree a] -> [FlatResource a]
flatten :: forall a. [ResourceTree a] -> [FlatResource a]
flatten =
(ResourceTree a -> [FlatResource a])
-> [ResourceTree a] -> [FlatResource a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (([ParentDetails a] -> [ParentDetails a])
-> Bool -> ResourceTree a -> [FlatResource a]
forall {a}.
([ParentDetails a] -> [ParentDetails a])
-> Bool -> ResourceTree a -> [FlatResource a]
go [ParentDetails a] -> [ParentDetails a]
forall a. a -> a
id Bool
True)
where
go :: ([ParentDetails a] -> [ParentDetails a])
-> Bool -> ResourceTree a -> [FlatResource a]
go [ParentDetails a] -> [ParentDetails a]
front Bool
check' (ResourceLeaf (Resource String
a [Piece a]
b Dispatch a
c [String]
_ Bool
check)) =
[[ParentDetails a]
-> String -> [Piece a] -> Dispatch a -> Bool -> FlatResource a
forall a.
[ParentDetails a]
-> String -> [Piece a] -> Dispatch a -> Bool -> FlatResource a
FlatResource ([ParentDetails a] -> [ParentDetails a]
front []) String
a [Piece a]
b Dispatch a
c (Bool
check' Bool -> Bool -> Bool
&& Bool
check)]
go [ParentDetails a] -> [ParentDetails a]
front Bool
check' (ResourceParent String
name Bool
check Set String
attrs [Piece a]
pieces [ResourceTree a]
children) =
(ResourceTree a -> [FlatResource a])
-> [ResourceTree a] -> [FlatResource a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (([ParentDetails a] -> [ParentDetails a])
-> Bool -> ResourceTree a -> [FlatResource a]
go ([ParentDetails a] -> [ParentDetails a]
front ([ParentDetails a] -> [ParentDetails a])
-> ([ParentDetails a] -> [ParentDetails a])
-> [ParentDetails a]
-> [ParentDetails a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((String -> [Piece a] -> Set String -> ParentDetails a
forall a. String -> [Piece a] -> Set String -> ParentDetails a
ParentDetails String
name [Piece a]
pieces Set String
attrs)ParentDetails a -> [ParentDetails a] -> [ParentDetails a]
forall a. a -> [a] -> [a]
:)) (Bool
check Bool -> Bool -> Bool
&& Bool
check')) [ResourceTree a]
children