{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE TemplateHaskell #-}
module Refined.Unsafe.Type
( Refined(Refined)
) where
import Control.DeepSeq (NFData)
import Data.Hashable (Hashable)
import qualified Language.Haskell.TH.Syntax as TH
newtype Refined (p :: k) x
= Refined x
deriving newtype
( Refined p x -> Refined p x -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k) x. Eq x => Refined p x -> Refined p x -> Bool
/= :: Refined p x -> Refined p x -> Bool
$c/= :: forall k (p :: k) x. Eq x => Refined p x -> Refined p x -> Bool
== :: Refined p x -> Refined p x -> Bool
$c== :: forall k (p :: k) x. Eq x => Refined p x -> Refined p x -> Bool
Eq
, Refined p x -> Refined p x -> Bool
Refined p x -> Refined p x -> Ordering
Refined p x -> Refined p x -> Refined p x
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {p :: k} {x}. Ord x => Eq (Refined p x)
forall k (p :: k) x. Ord x => Refined p x -> Refined p x -> Bool
forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Ordering
forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Refined p x
min :: Refined p x -> Refined p x -> Refined p x
$cmin :: forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Refined p x
max :: Refined p x -> Refined p x -> Refined p x
$cmax :: forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Refined p x
>= :: Refined p x -> Refined p x -> Bool
$c>= :: forall k (p :: k) x. Ord x => Refined p x -> Refined p x -> Bool
> :: Refined p x -> Refined p x -> Bool
$c> :: forall k (p :: k) x. Ord x => Refined p x -> Refined p x -> Bool
<= :: Refined p x -> Refined p x -> Bool
$c<= :: forall k (p :: k) x. Ord x => Refined p x -> Refined p x -> Bool
< :: Refined p x -> Refined p x -> Bool
$c< :: forall k (p :: k) x. Ord x => Refined p x -> Refined p x -> Bool
compare :: Refined p x -> Refined p x -> Ordering
$ccompare :: forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Ordering
Ord
, Int -> Refined p x -> Int
Refined p x -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
forall {k} {p :: k} {x}. Hashable x => Eq (Refined p x)
forall k (p :: k) x. Hashable x => Int -> Refined p x -> Int
forall k (p :: k) x. Hashable x => Refined p x -> Int
hash :: Refined p x -> Int
$chash :: forall k (p :: k) x. Hashable x => Refined p x -> Int
hashWithSalt :: Int -> Refined p x -> Int
$chashWithSalt :: forall k (p :: k) x. Hashable x => Int -> Refined p x -> Int
Hashable
, Refined p x -> ()
forall a. (a -> ()) -> NFData a
forall k (p :: k) x. NFData x => Refined p x -> ()
rnf :: Refined p x -> ()
$crnf :: forall k (p :: k) x. NFData x => Refined p x -> ()
NFData
)
deriving stock
( Int -> Refined p x -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) x. Show x => Int -> Refined p x -> ShowS
forall k (p :: k) x. Show x => [Refined p x] -> ShowS
forall k (p :: k) x. Show x => Refined p x -> String
showList :: [Refined p x] -> ShowS
$cshowList :: forall k (p :: k) x. Show x => [Refined p x] -> ShowS
show :: Refined p x -> String
$cshow :: forall k (p :: k) x. Show x => Refined p x -> String
showsPrec :: Int -> Refined p x -> ShowS
$cshowsPrec :: forall k (p :: k) x. Show x => Int -> Refined p x -> ShowS
Show
)
deriving stock
( forall a. Refined p a -> Bool
forall k (p :: k) a. Eq a => a -> Refined p a -> Bool
forall k (p :: k) a. Num a => Refined p a -> a
forall k (p :: k) a. Ord a => Refined p a -> a
forall k (p :: k) m. Monoid m => Refined p m -> m
forall k (p :: k) a. Refined p a -> Bool
forall k (p :: k) a. Refined p a -> Int
forall k (p :: k) a. Refined p a -> [a]
forall k (p :: k) a. (a -> a -> a) -> Refined p a -> a
forall k (p :: k) m a. Monoid m => (a -> m) -> Refined p a -> m
forall k (p :: k) b a. (b -> a -> b) -> b -> Refined p a -> b
forall k (p :: k) a b. (a -> b -> b) -> b -> Refined p a -> b
forall m a. Monoid m => (a -> m) -> Refined p a -> m
forall a b. (a -> b -> b) -> b -> Refined p 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
product :: forall a. Num a => Refined p a -> a
$cproduct :: forall k (p :: k) a. Num a => Refined p a -> a
sum :: forall a. Num a => Refined p a -> a
$csum :: forall k (p :: k) a. Num a => Refined p a -> a
minimum :: forall a. Ord a => Refined p a -> a
$cminimum :: forall k (p :: k) a. Ord a => Refined p a -> a
maximum :: forall a. Ord a => Refined p a -> a
$cmaximum :: forall k (p :: k) a. Ord a => Refined p a -> a
elem :: forall a. Eq a => a -> Refined p a -> Bool
$celem :: forall k (p :: k) a. Eq a => a -> Refined p a -> Bool
length :: forall a. Refined p a -> Int
$clength :: forall k (p :: k) a. Refined p a -> Int
null :: forall a. Refined p a -> Bool
$cnull :: forall k (p :: k) a. Refined p a -> Bool
toList :: forall a. Refined p a -> [a]
$ctoList :: forall k (p :: k) a. Refined p a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Refined p a -> a
$cfoldl1 :: forall k (p :: k) a. (a -> a -> a) -> Refined p a -> a
foldr1 :: forall a. (a -> a -> a) -> Refined p a -> a
$cfoldr1 :: forall k (p :: k) a. (a -> a -> a) -> Refined p a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Refined p a -> b
$cfoldl' :: forall k (p :: k) b a. (b -> a -> b) -> b -> Refined p a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Refined p a -> b
$cfoldl :: forall k (p :: k) b a. (b -> a -> b) -> b -> Refined p a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Refined p a -> b
$cfoldr' :: forall k (p :: k) a b. (a -> b -> b) -> b -> Refined p a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Refined p a -> b
$cfoldr :: forall k (p :: k) a b. (a -> b -> b) -> b -> Refined p a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Refined p a -> m
$cfoldMap' :: forall k (p :: k) m a. Monoid m => (a -> m) -> Refined p a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Refined p a -> m
$cfoldMap :: forall k (p :: k) m a. Monoid m => (a -> m) -> Refined p a -> m
fold :: forall m. Monoid m => Refined p m -> m
$cfold :: forall k (p :: k) m. Monoid m => Refined p m -> m
Foldable
)
type role Refined nominal nominal
instance (TH.Lift x) => TH.Lift (Refined p x) where
lift :: forall (m :: * -> *). Quote m => Refined p x -> m Exp
lift (Refined x
a) = [|Refined a|]
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped :: forall (m :: * -> *).
Quote m =>
Refined p x -> Code m (Refined p x)
liftTyped (Refined x
a) = [||Refined a||]
#endif