{-# 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
(Refined p x -> Refined p x -> Bool)
-> (Refined p x -> Refined p x -> Bool) -> Eq (Refined p x)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k) x. Eq x => 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
/= :: Refined p x -> Refined p x -> Bool
Eq
, Eq (Refined p x)
Eq (Refined p x) =>
(Refined p x -> Refined p x -> Ordering)
-> (Refined p x -> Refined p x -> Bool)
-> (Refined p x -> Refined p x -> Bool)
-> (Refined p x -> Refined p x -> Bool)
-> (Refined p x -> Refined p x -> Bool)
-> (Refined p x -> Refined p x -> Refined p x)
-> (Refined p x -> Refined p x -> Refined p x)
-> Ord (Refined p x)
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
$ccompare :: forall k (p :: k) x.
Ord x =>
Refined p x -> Refined p x -> Ordering
compare :: Refined p x -> Refined p x -> Ordering
$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
>= :: Refined p x -> Refined p x -> Bool
$cmax :: 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
$cmin :: 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
Ord
, Eq (Refined p x)
Eq (Refined p x) =>
(Int -> Refined p x -> Int)
-> (Refined p x -> Int) -> Hashable (Refined p x)
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
$chashWithSalt :: forall k (p :: k) x. Hashable x => Int -> Refined p x -> Int
hashWithSalt :: Int -> Refined p x -> Int
$chash :: forall k (p :: k) x. Hashable x => Refined p x -> Int
hash :: Refined p x -> Int
Hashable
, Refined p x -> ()
(Refined p x -> ()) -> NFData (Refined p x)
forall a. (a -> ()) -> NFData a
forall k (p :: k) x. NFData x => Refined p x -> ()
$crnf :: forall k (p :: k) x. NFData x => Refined p x -> ()
rnf :: Refined p x -> ()
NFData
)
deriving stock
( Int -> Refined p x -> ShowS
[Refined p x] -> ShowS
Refined p x -> String
(Int -> Refined p x -> ShowS)
-> (Refined p x -> String)
-> ([Refined p x] -> ShowS)
-> Show (Refined p x)
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
$cshowsPrec :: forall k (p :: k) x. Show x => Int -> Refined p x -> ShowS
showsPrec :: Int -> Refined p x -> ShowS
$cshow :: forall k (p :: k) x. Show x => Refined p x -> String
show :: Refined p x -> String
$cshowList :: forall k (p :: k) x. Show x => [Refined p x] -> ShowS
showList :: [Refined p x] -> ShowS
Show
)
deriving stock
( (forall m. Monoid m => Refined p m -> m)
-> (forall m a. Monoid m => (a -> m) -> Refined p a -> m)
-> (forall m a. Monoid m => (a -> m) -> Refined p a -> m)
-> (forall a b. (a -> b -> b) -> b -> Refined p a -> b)
-> (forall a b. (a -> b -> b) -> b -> Refined p a -> b)
-> (forall b a. (b -> a -> b) -> b -> Refined p a -> b)
-> (forall b a. (b -> a -> b) -> b -> Refined p a -> b)
-> (forall a. (a -> a -> a) -> Refined p a -> a)
-> (forall a. (a -> a -> a) -> Refined p a -> a)
-> (forall a. Refined p a -> [a])
-> (forall a. Refined p a -> Bool)
-> (forall a. Refined p a -> Int)
-> (forall a. Eq a => a -> Refined p a -> Bool)
-> (forall a. Ord a => Refined p a -> a)
-> (forall a. Ord a => Refined p a -> a)
-> (forall a. Num a => Refined p a -> a)
-> (forall a. Num a => Refined p a -> a)
-> Foldable (Refined p)
forall a. Eq a => a -> Refined p a -> Bool
forall a. Num a => Refined p a -> a
forall a. Ord a => Refined p a -> a
forall m. Monoid m => Refined p m -> m
forall a. Refined p a -> Bool
forall a. Refined p a -> Int
forall a. Refined p a -> [a]
forall a. (a -> a -> a) -> Refined p a -> a
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 b a. (b -> a -> b) -> b -> Refined p a -> b
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
$cfold :: forall k (p :: k) m. Monoid m => Refined p m -> m
fold :: forall m. Monoid m => Refined p m -> 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
foldMap' :: forall m a. Monoid m => (a -> m) -> Refined p a -> m
$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
foldr' :: forall a b. (a -> b -> 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
foldl' :: forall b a. (b -> a -> b) -> b -> Refined p a -> b
$cfoldr1 :: forall k (p :: k) a. (a -> a -> a) -> Refined p a -> a
foldr1 :: forall a. (a -> a -> a) -> Refined p a -> a
$cfoldl1 :: forall k (p :: k) a. (a -> a -> a) -> Refined p a -> a
foldl1 :: forall a. (a -> a -> a) -> Refined p a -> a
$ctoList :: forall k (p :: k) a. Refined p a -> [a]
toList :: forall a. Refined p a -> [a]
$cnull :: forall k (p :: k) a. Refined p a -> Bool
null :: forall a. Refined p a -> Bool
$clength :: forall k (p :: k) a. Refined p a -> Int
length :: forall a. Refined p a -> Int
$celem :: forall k (p :: k) a. Eq a => a -> Refined p a -> Bool
elem :: forall a. Eq a => a -> Refined p a -> Bool
$cmaximum :: forall k (p :: k) a. Ord a => Refined p a -> a
maximum :: forall a. Ord a => Refined p a -> a
$cminimum :: forall k (p :: k) a. Ord a => Refined p a -> a
minimum :: forall a. Ord a => Refined p a -> a
$csum :: forall k (p :: k) a. Num a => Refined p a -> a
sum :: forall a. Num a => Refined p a -> a
$cproduct :: forall k (p :: k) a. Num a => Refined p a -> a
product :: forall a. Num a => Refined p a -> a
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) = [||x -> Refined p x
forall k (p :: k) x. x -> Refined p x
Refined x
a||]
#endif