-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Create a Sized version of any container -- -- Create a Sized version of any container. @package sized-wrapper @version 0.1.0.0 -- | Create Sized version of any container. module Data.Sized -- | Sized proofed value. data Sized s a -- | Extract the Sized proven value ($sel:getSized:Sized) :: Sized s a -> a -- | Trusted value trustedSized :: a -> Sized s a -- | Unknown value unknownSized :: a -> Sized Unknown a -- | Unknown/any size data Unknown -- | Between (included) '(n..m)' data Between (n :: Nat) (m :: Nat) -- | Exactly n data Exactly (n :: Nat) -- | At least n data AtLeast (n :: Nat) -- | At most n data AtMost (n :: Nat) -- | Singleton constructible value class SizedSingleton a where { type family SizedSingletonElement a :: Type; } sizedSingleton :: SizedSingleton a => Proxy a -> SizedSingletonElement a -> a -- | Build a Sized value from a singleton value singleton :: SizedSingleton a => Proxy a -> SizedSingletonElement a -> Sized (Exactly 1) a -- | Build SizedSingleton for Applicative defined types to be -- used with DerivingVia: -- --
--   deriving instance SizedSingleton [a] via (MkSizedSingletonApplicative [a])
--   
newtype MkSizedSingletonApplicative a MkSizedSingletonApplicative :: a -> MkSizedSingletonApplicative a -- | Convert a container from possibly any size to Sized. class Size s sized :: (Size s, SizedFromContainer a) => a -> Maybe (Sized s a) -- | Used to attempt conversion from possibly any size to Sized. class SizedFromContainer a calculateSize :: SizedFromContainer a => a -> Int isAtLeast :: SizedFromContainer a => Int -> a -> Bool isAtMost :: SizedFromContainer a => Int -> a -> Bool isExactly :: SizedFromContainer a => Int -> a -> Bool isBetween :: SizedFromContainer a => Int -> Int -> a -> Bool -- | Build MkSizedFromContainerFoldable for Foldable defined -- types to be used with DerivingVia: -- --
--   deriving instance SizedFromContainer [a] via (MkSizedFromContainerFoldable [a])
--   
newtype MkSizedFromContainerFoldable a MkSizedFromContainerFoldable :: a -> MkSizedFromContainerFoldable a -- | Wrap and unwrap Sized (unsafe, be sure f is -- size-conservative) overSized :: (a -> b) -> Sized s a -> Sized s b -- | Wrap and unwrap Sized (unsafe, be sure f is -- size-conservative) overSized2 :: (a -> b -> c) -> Sized s a -> Sized s b -> Sized s c -- | Wrap and unwrap Sized (unsafe, be sure f is -- size-conservative) overSized3 :: (a -> b -> c -> d) -> Sized s a -> Sized s b -> Sized s c -> Sized s d -- | Wrap and unwrap Sized (unsafe, be sure f is -- size-conservative) overSized4 :: (a -> b -> c -> d -> e) -> Sized s a -> Sized s b -> Sized s c -> Sized s d -> Sized s e -- | Wrap and unwrap Sized (unsafe, be sure f is -- size-conservative) overSized5 :: (a -> b -> c -> d -> e -> f) -> Sized s a -> Sized s b -> Sized s c -> Sized s d -> Sized s e -> Sized s f -- | Wrap and unwrap Sized (unsafe, be sure f is respects -- output size) trustedChangeOverSized :: (a -> b) -> Sized s0 a -> Sized s1 b -- | Wrap and unwrap Sized (unsafe, be sure f is respects -- output size) trustedChangeOverSized2 :: (a -> b -> c) -> Sized s0 a -> Sized s1 b -> Sized s2 c -- | Wrap and unwrap Sized (unsafe, be sure f is respects -- output size) trustedChangeOverSized3 :: (a -> b -> c -> d) -> Sized s0 a -> Sized s1 b -> Sized s2 c -> Sized s3 d -- | Wrap and unwrap Sized (unsafe, be sure f is respects -- output size) trustedChangeOverSized4 :: (a -> b -> c -> d -> e) -> Sized s0 a -> Sized s1 b -> Sized s2 c -> Sized s3 d -> Sized s4 e -- | Wrap and unwrap Sized (unsafe, be sure f is respects -- output size) trustedChangeOverSized5 :: (a -> b -> c -> d -> e -> f) -> Sized s0 a -> Sized s1 b -> Sized s2 c -> Sized s3 d -> Sized s4 e -> Sized s5 f -- | fmap over a Sized container fmapSized :: Functor f => (a -> b) -> Sized s (f a) -> Sized s (f b) -- | Apply an unsafe function over empty, which is safe over Sized withSized :: (a -> Maybe b) -> Sized s a -> b -- | Give a more precise sizing precise :: (SizedFromContainer a, Size s) => Sized s' a -> Maybe (Sized s a) -- | Give a more general sizing approximate :: IsMoreGeneral s s' => Sized s' a -> Sized s a -- | Semigroup append (<<>>) :: Semigroup a => Sized s a -> Sized s' a -> Sized (s <+> s') a infixr 6 <<>> -- | Concatenative operation of Sized withSizedAppend :: (a -> b -> c) -> Sized s a -> Sized s' b -> Sized (s <+> s') c withSizedRetract :: (a -> b) -> Sized s a -> Sized (RestrictAtMost s) b withSizedSubtract :: (a -> b -> c) -> Sized s a -> Sized s' b -> Sized (s <-> s') c withSizedProduct :: (a -> b -> c) -> Sized s a -> Sized s' b -> Sized (s <*> s') c type family IsMoreGeneral general restrictive :: Constraint type IsNotEmpty s = IsMoreGeneral s (Exactly 1) type family (<+>) a b type family RestrictAtMost a type family (<->) a b type family (<*>) a b type family Includes (sized :: Type) (size :: Nat) :: Constraint instance GHC.Show.Show a => GHC.Show.Show (Data.Sized.Sized s a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Sized.Sized s a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Sized.Sized s a) instance Data.Sized.Size Data.Sized.Unknown instance GHC.TypeNats.KnownNat n => Data.Sized.Size (Data.Sized.Exactly n) instance GHC.TypeNats.KnownNat n => Data.Sized.Size (Data.Sized.AtLeast n) instance GHC.TypeNats.KnownNat n => Data.Sized.Size (Data.Sized.AtMost n) instance (GHC.TypeNats.KnownNat n, GHC.TypeNats.KnownNat m, n GHC.TypeNats.<= m) => Data.Sized.Size (Data.Sized.Between n m) instance Data.Foldable.Foldable f => Data.Sized.SizedFromContainer (f a) instance GHC.Base.Applicative f => Data.Sized.SizedSingleton (f a)