{-# LANGUAGE DataKinds #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module LightGBM.Utils.Types
(
PositiveInt
, IntGreaterThanOne
, ProperFraction
, OpenProperFraction
, LeftOpenProperFraction
, OneToTwoLeftSemiClosed
, PositiveDouble
, NonNegativeDouble
, OutLog (..)
, ErrLog (..)
) where
import Data.Hashable (Hashable, hashWithSalt)
import qualified Data.Text as T
import qualified Refined as R
type ProperFraction
= R.Refined (R.And (R.Not (R.LessThan 0)) (R.Not (R.GreaterThan 1))) Double
type LeftOpenProperFraction
= R.Refined (R.And (R.GreaterThan 0) (R.Not (R.GreaterThan 1))) Double
type OpenProperFraction
= R.Refined (R.And (R.GreaterThan 0) (R.LessThan 1)) Double
type OneToTwoLeftSemiClosed
= R.Refined (R.And (R.Not (R.LessThan 1)) (R.LessThan 2)) Double
type PositiveInt = R.Refined R.Positive Int
type IntGreaterThanOne = R.Refined (R.GreaterThan 1) Int
type PositiveDouble = R.Refined R.Positive Double
type NonNegativeDouble = R.Refined R.NonNegative Double
instance (Hashable a, R.Predicate p a) => Hashable (R.Refined p a) where
hashWithSalt salt refinedA = hashWithSalt salt (R.unrefine refinedA)
newtype OutLog = OutLog T.Text deriving Show
newtype ErrLog = ErrLog T.Text deriving Show