module Data.CardinalityRange (
CardinalityRange_From
, CardinalityRange_To
, CardinalityRange
, cardinalityRange
, cr2Tuple
, lazyVerfyCR
, cFitsInCR_Proto
, cFitsInCR
, fitsInCR
, fitsInCR_T
, FirstOrSecond(..)
, Compare2CRsError(..)
, compare2CRs
, crFitsInCR
, crNoConstraint
, cr0
, cr1
, cr0_1
, cr0_Inf
, cr1_Inf
, crX
, crXY
, CardinalityConstraint
, cFitsInCC
, fitsInCC
, fitsInCC_T
, HasCardConstr(..)
, HasCardConstrT(..)
, cFitsIn
, cFitsInT
, fitsIn
, fitsInT
, HasCardUCT(..)
, HasCardUCT_T(..)
, TransformError_FromTypeName
, TransformError_ToTypeName
, TransformError_Details
, uContError
, uContErrorT
, sContTrans
, sContTransT
) where
import Data.Cardinality
import Data.EmptySet
import Data.Intersectable
import Data.NeverEmptyList
import qualified Data.Map as M
import Data.Map (Map, (!))
import Data.Word
import Data.Typeable
import Control.Monad.Identity
type CardinalityRange_From = LazyCardinality
type CardinalityRange_To = LazyCardinality
data CardinalityRange = CardinalityRange CardinalityRange_From CardinalityRange_To deriving (Show)
cardinalityRange :: CardinalityRange_From -> CardinalityRange_To -> CardinalityRange
cardinalityRange from to =
case lazyVerfyCR from to of
Just False -> error $ "Cardinality range can't be constructed with lower boundary higher than lower one (" ++ show from ++ ", "++ show to ++ ")."
_ -> CardinalityRange from to
cr2Tuple :: CardinalityRange -> (CardinalityRange_From, CardinalityRange_From)
cr2Tuple (CardinalityRange from to) = (from, to)
lazyVerfyCR :: CardinalityRange_From -> CardinalityRange_To -> Maybe Bool
lazyVerfyCR from to = lazyCompare2LCs from to >>= return . (/= GT)
cFitsInCR_Proto :: LazyCardinality -> CardinalityRange -> (Ordering, LazyCardinality, CardinalityRange)
cFitsInCR_Proto c (CardinalityRange lo_c hi_c) =
let (ord1, c_2, lo_c_2) = c `almostStrictCompare2LCs` lo_c
in case ord1 of
LT -> (ord1, c_2, cardinalityRange lo_c_2 hi_c)
_ -> let (ord2, c_3, hi_c_2) = c_2 `almostStrictCompare2LCs` hi_c
ord3 = case ord2 of { GT -> GT; _ -> EQ }
in (ord3, c_3, cardinalityRange lo_c_2 hi_c_2)
infixr 9 `cFitsInCR_Proto`
cFitsInCR :: LazyCardinality -> CardinalityRange -> Bool
cFitsInCR c cr = fst3 (c `cFitsInCR_Proto` cr) == EQ
where fst3 (a,_,_) = a
infixr 9 `cFitsInCR`
fitsInCR :: HasCard a => a -> CardinalityRange -> Bool
fitsInCR hasC cr = cardOf hasC `cFitsInCR` cr
infixr 9 `fitsInCR`
fitsInCR_T :: HasCardT c => c a -> CardinalityRange -> Bool
fitsInCR_T hasC cr = cardOfT hasC `cFitsInCR` cr
infixr 9 `fitsInCR_T`
data FirstOrSecond = First | Second deriving (Show)
data Compare2CRsError = LowerBoundaryAfterHigher FirstOrSecond CardinalityRange
instance Show Compare2CRsError where
show e = "An error occurred when trying to compare 2 cardinality ranges: " ++
case e of
LowerBoundaryAfterHigher fs cr -> show fs ++ " cardinality range (" ++ show cr ++ ") is ill defined - lower boundary is greater then higher one."
compare2CRs :: CardinalityRange -> CardinalityRange -> (Either Compare2CRsError (SetsFit CardinalityRange), CardinalityRange, CardinalityRange)
compare2CRs (CardinalityRange lo_cr1_0 hi_cr1_0) (CardinalityRange lo_cr2_0 hi_cr2_0) =
let step1@(order1, hi_cr1_1, lo_cr2_1) = almostStrictCompare2LCs hi_cr1_0 lo_cr2_0
in case order1 of
LT -> (Right NoIntersection, CardinalityRange lo_cr1_0 hi_cr1_1, CardinalityRange lo_cr2_1 hi_cr2_0)
EQ -> let step2@(order2, lo_cr1_1, hi_cr1_2) = almostStrictCompare2LCs lo_cr1_0 hi_cr1_1
cr1_2 = CardinalityRange lo_cr1_1 hi_cr1_2
cr2_2 = CardinalityRange lo_cr2_1 hi_cr2_0
answ_2 err_or_fit = (err_or_fit, cr1_2, cr2_2)
in case order2 of
LT -> let step21@(order21, lo_cr2_2, hi_cr2_1) = almostStrictCompare2LCs lo_cr2_1 hi_cr2_0
cr1_21 = CardinalityRange lo_cr1_1 hi_cr1_2
cr2_21 = CardinalityRange lo_cr2_2 hi_cr2_1
answ_21 err_or_fit = (err_or_fit, cr1_21, cr2_21)
in answ_21 $ case order21 of
EQ -> Right SecondInFirst
GT -> Right $ Intersection $ CardinalityRange hi_cr1_2 lo_cr2_2
LT -> Left $ LowerBoundaryAfterHigher Second cr2_21
GT -> answ_2 $ Left $ LowerBoundaryAfterHigher First cr1_2
EQ -> let step3@(order3, lo_cr2_2, hi_cr2_1) = almostStrictCompare2LCs lo_cr2_1 hi_cr2_0
cr1_3 = CardinalityRange lo_cr1_1 hi_cr1_2
cr2_3 = CardinalityRange lo_cr2_2 hi_cr2_1
answ_3 err_or_fit = (err_or_fit, cr1_3, cr2_3)
in answ_3 $ case order3 of
LT -> Right FirstInSecond
EQ -> Right EqualSets
GT -> Left $ LowerBoundaryAfterHigher First cr1_3
GT -> let step4@(order4, lo_cr1_1, hi_cr2_1) = almostStrictCompare2LCs lo_cr1_0 hi_cr2_0
in case order4 of
GT -> (Right NoIntersection, CardinalityRange lo_cr1_1 hi_cr1_1, CardinalityRange lo_cr2_1 hi_cr2_1)
EQ -> let step5@(order5, lo_cr2_2, hi_cr2_2) = almostStrictCompare2LCs lo_cr2_1 hi_cr2_1
cr1_5 = CardinalityRange lo_cr1_1 hi_cr1_1
cr2_5 = CardinalityRange lo_cr2_2 hi_cr2_2
answ_5 err_or_fit = (err_or_fit, cr1_5, cr2_5)
in case order5 of
LT -> let step51@(order51, lo_cr1_2, hi_cr1_2) = almostStrictCompare2LCs lo_cr1_1 hi_cr1_1
cr1_51 = CardinalityRange lo_cr1_2 hi_cr1_2
cr2_51 = CardinalityRange lo_cr2_2 hi_cr2_2
answ_51 err_or_fit = (err_or_fit, cr1_51, cr2_51)
in answ_51 $ case order51 of
LT -> Left $ LowerBoundaryAfterHigher First cr1_51
EQ -> Right FirstInSecond
GT -> Right $ Intersection $ CardinalityRange lo_cr1_2 hi_cr2_2
EQ -> answ_5 $ Right SecondInFirst
GT -> answ_5 $ Left $ LowerBoundaryAfterHigher Second cr2_5
LT -> let step6@(order6, lo_cr1_2, lo_cr2_2) = almostStrictCompare2LCs lo_cr1_1 lo_cr2_1
step7@(order7, hi_cr1_2, hi_cr2_2) = almostStrictCompare2LCs hi_cr1_1 hi_cr2_1
cr1_67 = CardinalityRange lo_cr1_2 hi_cr1_2
cr2_67 = CardinalityRange lo_cr2_2 hi_cr2_2
answ_67 _fit = (Right _fit, cr1_67, cr2_67)
in answ_67 $ case (order6, order7) of
(EQ, EQ) -> EqualSets
(EQ, GT) -> SecondInFirst
(LT, EQ) -> SecondInFirst
(LT, GT) -> SecondInFirst
(EQ, LT) -> FirstInSecond
(GT, LT) -> FirstInSecond
(GT, EQ) -> FirstInSecond
(LT, LT) -> Intersection $ CardinalityRange lo_cr2_2 hi_cr1_2
(GT, GT) -> Intersection $ CardinalityRange lo_cr1_2 hi_cr2_2
instance Intersectable CardinalityRange where
setFits cr1 cr2 = case fst3 $ compare2CRs cr1 cr2 of { Right r -> r; Left e -> error $ show e }
where
fst3 :: (a,b,c) -> a
fst3 (a,_,_) = a
crFitsInCR :: CardinalityRange -> CardinalityRange -> SetsFit CardinalityRange
crFitsInCR = setFits
infixr 9 `crFitsInCR`
crNoConstraint :: CardinalityRange
cr0 :: CardinalityRange
cr1 :: CardinalityRange
cr0_1 :: CardinalityRange
cr0_Inf :: CardinalityRange
cr1_Inf :: CardinalityRange
crX :: PreciseCardinality -> CardinalityRange
crXY :: PreciseCardinality -> PreciseCardinality -> CardinalityRange
crNoConstraint = cr0_Inf
cr0 = cardinalityRange (preciseC 0) (preciseC 0)
cr1 = cardinalityRange (preciseC 1) (preciseC 1)
cr0_1 = cardinalityRange (preciseC 0) (preciseC 1)
cr0_Inf = cardinalityRange (preciseC 0) infiniteC
cr1_Inf = cardinalityRange (preciseC 1) infiniteC
crX x = cardinalityRange (preciseC x) (preciseC x)
crXY x y = cardinalityRange (preciseC x) (preciseC y)
type CardinalityConstraint = CardinalityRange
cFitsInCC :: LazyCardinality -> CardinalityConstraint -> Bool
cFitsInCC = cFitsInCR
infixr 9 `cFitsInCC`
fitsInCC :: HasCard a => a -> CardinalityConstraint -> Bool
fitsInCC = fitsInCR
infixr 9 `fitsInCC`
fitsInCC_T :: HasCardT c => c a -> CardinalityConstraint -> Bool
fitsInCC_T = fitsInCR_T
infixr 9 `fitsInCC_T`
class HasCardConstr a where
cardinalityConstraintOf :: a -> CardinalityConstraint
class HasCardConstrT c where
cardinalityConstraintOfT :: c a -> CardinalityConstraint
cFitsIn :: HasCardConstr b => LazyCardinality -> b -> Bool
cFitsIn c hasCC = c `cFitsInCC` cardinalityConstraintOf hasCC
infixr 9 `cFitsIn`
cFitsInT :: HasCardConstrT c => LazyCardinality -> c b -> Bool
cFitsInT c hasCC = c `cFitsInCC` cardinalityConstraintOfT hasCC
infixr 9 `cFitsInT`
fitsIn :: (HasCard a, HasCardConstr b) => a -> b -> Bool
fitsIn hasC hasCC = cardOf hasC `cFitsInCC` cardinalityConstraintOf hasCC
infixr 9 `fitsIn`
fitsInT :: (HasCardT c, HasCardConstrT d) => c a -> d b -> Bool
fitsInT hasC hasCC = cardOfT hasC `cFitsInCC` cardinalityConstraintOfT hasCC
infixr 9 `fitsInT`
class HasCardUCT from to where
uContTrans :: from -> to
class HasCardUCT_T from to where
uContTransT :: from a -> to a
type TransformError_FromTypeName = String
type TransformError_ToTypeName = String
type TransformError_Details = String
uContError :: TransformError_FromTypeName -> TransformError_ToTypeName -> TransformError_Details -> a
uContError from_t_name to_t_name details = error $
"An error occurred in the instance of HasCardUCT"
++ ", when trying to transform from type '" ++ from_t_name ++ "' to type '" ++ to_t_name ++ "'."
++ (case details of
[] -> ""
_ -> "Details: '" ++ details ++ "'."
)
uContErrorT :: TransformError_FromTypeName -> TransformError_ToTypeName -> TransformError_Details -> a
uContErrorT from_t_name to_t_name details = error $
"An error occurred in the instance of HasCardUCT_T"
++ ", when trying to transform from type '" ++ from_t_name ++ "' to type '" ++ to_t_name ++ "'."
++ (case details of
[] -> ""
_ -> "Details: '" ++ details ++ "'."
)
sContTrans :: ( HasCard from
, HasCardConstr to
, HasCardUCT from to
) => from -> Maybe to
sContTrans from =
let to = uContTrans from
in case from `fitsIn` to of
True -> Just to
False -> Nothing
sContTransT :: ( HasCardT from
, HasCardConstrT to
, HasCardUCT_T from to
) => from a -> Maybe (to a)
sContTransT from =
let to = uContTransT from
in case from `fitsInT` to of
True -> Just to
False -> Nothing
instance HasCardConstr () where
cardinalityConstraintOf _ = cr0
instance HasCardConstr (EmptySet a) where
cardinalityConstraintOf _ = cr0
instance HasCardConstrT EmptySet where
cardinalityConstraintOfT _ = cr0
instance HasCardConstr (Identity a) where
cardinalityConstraintOf _ = cr1
instance HasCardConstrT Identity where
cardinalityConstraintOfT _ = cr1
instance HasCardConstr (Maybe a) where
cardinalityConstraintOf _ = cr0_1
instance HasCardConstrT Maybe where
cardinalityConstraintOfT _ = cr0_1
instance HasCardConstr [a] where
cardinalityConstraintOf _ = cr0_Inf
instance HasCardConstrT ([]) where
cardinalityConstraintOfT _ = cr0_Inf
instance HasCardConstr (NeverEmptyList a) where
cardinalityConstraintOf _ = cr1_Inf
instance HasCardConstrT NeverEmptyList where
cardinalityConstraintOfT _ = cr1_Inf
instance HasCardConstr (Map k e) where
cardinalityConstraintOf _ = cr0_Inf
instance HasCardConstrT (Map k) where
cardinalityConstraintOfT _ = cr0_Inf
instance HasCardConstr (a,a) where { cardinalityConstraintOf _ = crX 2 }
instance HasCardConstr (a,a,a) where { cardinalityConstraintOf _ = crX 3 }
instance HasCardConstr (a,a,a,a) where { cardinalityConstraintOf _ = crX 4 }
instance HasCardConstr (a,a,a,a,a) where { cardinalityConstraintOf _ = crX 5 }
instance HasCardConstr (a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 6 }
instance HasCardConstr (a,a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 7 }
instance HasCardConstr (a,a,a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 8 }
instance HasCardConstr (a,a,a,a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 9 }
instance HasCardConstr (a,a,a,a,a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 10 }
instance HasCardConstr (a,a,a,a,a,a,a,a,a,a,a) where { cardinalityConstraintOf _ = crX 11 }
instance HasCardUCT (EmptySet a) () where
uContTrans _ = ()
instance HasCardUCT () (EmptySet a) where
uContTrans _ = EmptySet
instance HasCardUCT (EmptySet a) (Maybe a) where
uContTrans _ = Nothing
instance HasCardUCT_T EmptySet Maybe where
uContTransT = uContTrans
instance HasCardUCT (Maybe a) (EmptySet a) where
uContTrans Nothing = EmptySet
uContTrans _ = uContError "Maybe a" "EmptySet a" "something can not be nothing"
instance HasCardUCT_T Maybe EmptySet where
uContTransT Nothing = EmptySet
uContTransT _ = uContErrorT "Maybe" "EmptySet" "something can not be nothing"
instance HasCardUCT (EmptySet a) [a] where
uContTrans _ = []
instance HasCardUCT_T EmptySet ([]) where
uContTransT = uContTrans
instance HasCardUCT [a] (EmptySet a) where
uContTrans [] = EmptySet
uContTrans _ = uContError "[a]" "EmptySet a" "something can not be nothing"
instance HasCardUCT_T ([]) EmptySet where
uContTransT [] = EmptySet
uContTransT _ = uContErrorT "[]" "EmptySet" "something can not be nothing"
instance HasCardUCT (EmptySet (k, e)) (Map k e) where
uContTrans _ = M.empty
instance HasCardUCT (Map k e) (EmptySet (k, e)) where
uContTrans mp =
case M.null mp of
True -> EmptySet
False -> uContError "Map k e" "EmptySet (k, e)" "something can not be nothing"
instance HasCardUCT (k, e) (Map k e) where
uContTrans = uncurry M.singleton
instance HasCardUCT_T ((,) k) (Map k) where
uContTransT = uContTrans
instance HasCardUCT (Map k e) (k, e) where
uContTrans mp =
case M.minViewWithKey mp of
Nothing -> uContError "Map k e" "(k, e)" "nothing to identify in empty list"
Just (row, rest_mp) ->
case M.null rest_mp of
True -> row
False -> uContError "Map k e" "(k, e)" "too many identities"
instance HasCardUCT_T (Map k) ((,) k) where
uContTransT = uContTrans
instance HasCardUCT (Identity a) (Maybe a) where
uContTrans = Just . runIdentity
instance HasCardUCT_T Identity Maybe where
uContTransT = uContTrans
instance HasCardUCT (Identity a) [a] where
uContTrans i = [runIdentity i]
instance HasCardUCT_T Identity ([]) where
uContTransT = uContTrans
instance HasCardUCT (Identity a) (NeverEmptyList a) where
uContTrans i = NEL (runIdentity i) []
instance HasCardUCT_T Identity NeverEmptyList where
uContTransT = uContTrans
instance HasCardUCT (Identity (k, e)) (Map k e) where
uContTrans = uContTrans . runIdentity
instance HasCardUCT (Maybe a) (Identity a) where
uContTrans (Just a) = Identity a
uContTrans Nothing = uContError "Maybe a" "Identity a" "nothing to identify in Nothing"
instance HasCardUCT_T Maybe Identity where
uContTransT = uContTrans
instance HasCardUCT [a] (Identity a) where
uContTrans [] = uContError "[a]" "Identity a" "nothing to identify in empty list"
uContTrans (h : []) = Identity h
uContTrans (h : _) = uContError "[a]" "Identity a" "too many identities"
instance HasCardUCT_T ([]) Identity where
uContTransT = uContTrans
instance HasCardUCT (NeverEmptyList a) (Identity a) where
uContTrans (NEL h []) = Identity h
uContTrans (NEL _ _) = uContError "NeverEmptyList a" "Identity a" "too many identities"
instance HasCardUCT_T NeverEmptyList Identity where
uContTransT = uContTrans
instance HasCardUCT (Map k e) (Identity (k, e)) where
uContTrans mp =
case M.minViewWithKey mp of
Nothing -> uContError "Map k e" "Identity (k, e)" "nothing to identify in empty list"
Just (row, rest_mp) ->
case M.null rest_mp of
True -> Identity row
False -> uContError "Map k e" "Identity (k, e)" "too many identities"
instance HasCardUCT () (Maybe a) where
uContTrans _ = Nothing
instance HasCardUCT () [a] where
uContTrans _ = []
instance HasCardUCT () (Map k e) where
uContTrans _ = M.empty
instance HasCardUCT (Maybe a) () where
uContTrans Nothing = ()
uContTrans _ = uContError "Maybe a" "()" "only Nothing transforms to unity"
instance HasCardUCT [a] () where
uContTrans [] = ()
uContTrans _ = uContError "[a]" "()" "only empty list transforms to unity"
instance HasCardUCT (Map k e) () where
uContTrans mp = case M.null mp of { True -> (); False -> uContError "Map a" "()" "only empty map transforms to unity"}
instance HasCardUCT (Maybe a) [a] where
uContTrans Nothing = []
uContTrans (Just a) = [a]
instance HasCardUCT_T Maybe ([]) where
uContTransT = uContTrans
instance HasCardUCT (Maybe a) (NeverEmptyList a) where
uContTrans Nothing = uContError "Maybe a" "NeverEmptyList a" "there must be at least 1 element, Nothing is not the case"
uContTrans (Just a) = (NEL a [])
instance HasCardUCT_T Maybe NeverEmptyList where
uContTransT Nothing = uContErrorT "Maybe" "NeverEmptyList" "there must be at least 1 element, Nothing is not the case"
uContTransT (Just a) = (NEL a [])
instance HasCardUCT (Maybe (k, e)) (Map k e) where
uContTrans Nothing = M.empty
uContTrans (Just (k, e)) = M.singleton k e
instance HasCardUCT [a] (Maybe a) where
uContTrans [] = Nothing
uContTrans (h : []) = Just h
uContTrans _ = uContError "[a]" "Maybe a" "too many elements to fit in Maybe"
instance HasCardUCT_T ([]) Maybe where
uContTransT [] = Nothing
uContTransT (h : []) = Just h
uContTransT _ = uContErrorT "[]" "Maybe" "too many elements to fit in Maybe"
instance HasCardUCT (NeverEmptyList a) (Maybe a) where
uContTrans (NEL a []) = Just a
uContTrans _ = uContError "NeverEmptyList a" "Maybe a" "too many elements to fit in Maybe"
instance HasCardUCT_T NeverEmptyList Maybe where
uContTransT (NEL a []) = Just a
uContTransT _ = uContErrorT "NeverEmptyList" "Maybe" "too many elements to fit in Maybe"
instance HasCardUCT (Map k e) (Maybe (k, e)) where
uContTrans mp =
case M.minViewWithKey mp of
Nothing -> Nothing
Just (row, rest_mp) ->
case M.null rest_mp of
True -> Just row
False -> uContError "Map k e" "Maybe (k, e)" "too many elements to fit in Maybe"
instance HasCardUCT [a] (NeverEmptyList a) where
uContTrans [] = uContError "[a]" "NeverEmptyList a" "there must be at least 1 element"
uContTrans (h : t) = (NEL h t)
instance HasCardUCT_T ([]) NeverEmptyList where
uContTransT [] = uContErrorT "[a]" "NeverEmptyList a" "there must be at least 1 element"
uContTransT (h : t) = (NEL h t)
instance Ord k => HasCardUCT [(k, e)] (Map k e) where
uContTrans = M.fromList
instance HasCardUCT (NeverEmptyList a) [a] where
uContTrans (NEL h t) = (h:t)
instance HasCardUCT_T NeverEmptyList ([]) where
uContTransT = uContTrans
instance HasCardUCT (Map k e) [(k, e)] where
uContTrans = M.toList
instance Ord k => HasCardUCT (NeverEmptyList (k, e)) (Map k e) where
uContTrans (NEL h t) = M.fromList (h:t)
instance HasCardUCT (Map k e) (NeverEmptyList (k, e)) where
uContTrans mp = case M.null mp of { False -> let (h:t) = M.toList mp in (NEL h t) ; True -> uContError "Map k e" "NeverEmptyList (k, e)" "there must be at least 1 element" }
instance HasCardUCT [a] (a,a) where { uContTrans l = case l of { (a:b:[]) -> (a,b); _ -> uContError "[a]" "(a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a) where { uContTrans l = case l of { (a:b:c:[]) -> (a,b,c); _ -> uContError "[a]" "(a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:[]) -> (a,b,c,d); _ -> uContError "[a]" "(a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:[]) -> (a,b,c,d,e); _ -> uContError "[a]" "(a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:[]) -> (a,b,c,d,e,f); _ -> uContError "[a]" "(a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:g:[]) -> (a,b,c,d,e,f,g); _ -> uContError "[a]" "(a,a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:g:h:[]) -> (a,b,c,d,e,f,g,h); _ -> uContError "[a]" "(a,a,a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:g:h:i:[]) -> (a,b,c,d,e,f,g,h,i); _ -> uContError "[a]" "(a,a,a,a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:g:h:i:j:[]) -> (a,b,c,d,e,f,g,h,i,j); _ -> uContError "[a]" "(a,a,a,a,a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT [a] (a,a,a,a,a,a,a,a,a,a,a) where { uContTrans l = case l of { (a:b:c:d:e:f:g:h:i:j:k:[]) -> (a,b,c,d,e,f,g,h,i,j,k); _ -> uContError "[a]" "(a,a,a,a,a,a,a,a,a,a,a)" "wrong count of elements" } }
instance HasCardUCT (a,a) [a] where { uContTrans (a,b) = (a:b:[]) }
instance HasCardUCT (a,a,a) [a] where { uContTrans (a,b,c) = (a:b:c:[]) }
instance HasCardUCT (a,a,a,a) [a] where { uContTrans (a,b,c,d) = (a:b:c:d:[]) }
instance HasCardUCT (a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e) = (a:b:c:d:e:[]) }
instance HasCardUCT (a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f) = (a:b:c:d:e:f:[]) }
instance HasCardUCT (a,a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f,g) = (a:b:c:d:e:f:g:[]) }
instance HasCardUCT (a,a,a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f,g,h) = (a:b:c:d:e:f:g:h:[]) }
instance HasCardUCT (a,a,a,a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f,g,h,i) = (a:b:c:d:e:f:g:h:i:[]) }
instance HasCardUCT (a,a,a,a,a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f,g,h,i,j) = (a:b:c:d:e:f:g:h:i:j:[]) }
instance HasCardUCT (a,a,a,a,a,a,a,a,a,a,a) [a] where { uContTrans (a,b,c,d,e,f,g,h,i,j,k) = (a:b:c:d:e:f:g:h:i:j:k:[]) }