-- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./QuantLib/Time/Schedule.chs" #-}
-- DayCounterConstructor is declared in QuantLib.Internal.CalendarEnum, but its Read instance
-- needs `calendar` (QuantLib.Time.Calendar), and CalendarEnum -> Schedule -> CalendarEnum
-- would be a cycle if the instance lived there instead -- see deriveReadPlain's comment in
-- Internal/Syntax.hs. Deliberate, not a stray orphan.
{-# OPTIONS_GHC -Wno-orphans #-}
module QuantLib.Time.Schedule
  (
    -- * Types
    DayCounter
  , Schedule
  , DayCounterConstructor(..)
  , DateGenerationRule(..)
  , TimeUnit(..)
  , Frequency(..)

    -- * Constructors
  , dayCounter
  , schedule
  , fromDates

    -- * Inspectors
    -- ** Day counts
  , days
  , yearFraction
    -- ** Schedule and period operations
  , until
  , fromFrequency
  , toFrequency
  , parse
  , add
  , divide
  , lessThan
  , normalize

    -- ** Schedule fields
  , dates
  ) where
import qualified Foreign.C.String as C2HSImp
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp


import Prelude hiding(until)

import QuantLib.Time.Date
import QuantLib.Internal
import QuantLib.Internal.Type
import QuantLib.Internal.Common
import QuantLib.Internal.CalendarEnum
import QuantLib.Time.Calendar (calendar)
import System.IO.Unsafe(unsafePerformIO)







data DateGenerationRule = Backward
                        | Forward
                        | Zero
                        | ThirdWednesday
                        | ThirdWednesdayInclusive
                        | Twentieth
                        | TwentiethIMM
                        | OldCDS
                        | CDS
                        | CDS2015
  deriving (Enum,Show,Eq,Read)

{-# LINE 54 "./QuantLib/Time/Schedule.chs" #-}

data Frequency = NoFrequency
               | Once
               | Annual
               | Semiannual
               | EveryFourthMonth
               | Quarterly
               | Bimonthly
               | Monthly
               | EveryFourthWeek
               | Biweekly
               | Weekly
               | Daily
               | OtherFrequency
  deriving (Show,Eq,Read,Bounded)
instance Enum Frequency where
  succ NoFrequency = Once
  succ Once = Annual
  succ Annual = Semiannual
  succ Semiannual = EveryFourthMonth
  succ EveryFourthMonth = Quarterly
  succ Quarterly = Bimonthly
  succ Bimonthly = Monthly
  succ Monthly = EveryFourthWeek
  succ EveryFourthWeek = Biweekly
  succ Biweekly = Weekly
  succ Weekly = Daily
  succ Daily = OtherFrequency
  succ OtherFrequency = error "Frequency.succ: OtherFrequency has no successor"

  pred Once = NoFrequency
  pred Annual = Once
  pred Semiannual = Annual
  pred EveryFourthMonth = Semiannual
  pred Quarterly = EveryFourthMonth
  pred Bimonthly = Quarterly
  pred Monthly = Bimonthly
  pred EveryFourthWeek = Monthly
  pred Biweekly = EveryFourthWeek
  pred Weekly = Biweekly
  pred Daily = Weekly
  pred OtherFrequency = Daily
  pred NoFrequency = error "Frequency.pred: NoFrequency has no predecessor"

  enumFromTo :: Frequency -> Frequency -> [Frequency]
enumFromTo Frequency
from Frequency
to = Frequency -> [Frequency]
forall {t}. Enum t => t -> [t]
go Frequency
from
    where
      end :: Int
end = Frequency -> Int
forall a. Enum a => a -> Int
fromEnum Frequency
to
      go :: t -> [t]
go t
v = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (t -> Int
forall a. Enum a => a -> Int
fromEnum t
v) Int
end of
                 Ordering
LT -> t
v t -> [t] -> [t]
forall a. a -> [a] -> [a]
: t -> [t]
go (t -> t
forall a. Enum a => a -> a
succ t
v)
                 Ordering
EQ -> [t
v]
                 Ordering
GT -> []

  enumFrom from = enumFromTo from OtherFrequency

  fromEnum NoFrequency = (-1)
  fromEnum Once = 0
  fromEnum Annual = 1
  fromEnum Semiannual = 2
  fromEnum EveryFourthMonth = 3
  fromEnum Quarterly = 4
  fromEnum Bimonthly = 6
  fromEnum Monthly = 12
  fromEnum EveryFourthWeek = 13
  fromEnum Biweekly = 26
  fromEnum Weekly = 52
  fromEnum Daily = 365
  fromEnum OtherFrequency = 999

  toEnum (-1) = NoFrequency
  toEnum 0 = Once
  toEnum 1 = Annual
  toEnum 2 = Semiannual
  toEnum 3 = EveryFourthMonth
  toEnum 4 = Quarterly
  toEnum 6 = Bimonthly
  toEnum 12 = Monthly
  toEnum 13 = EveryFourthWeek
  toEnum 26 = Biweekly
  toEnum 52 = Weekly
  toEnum 365 = Daily
  toEnum 999 = OtherFrequency
  toEnum unmatched = error ("Frequency.toEnum: Cannot match " ++ show unmatched)

{-# LINE 55 "./QuantLib/Time/Schedule.chs" #-}



{-# LINE 57 "./QuantLib/Time/Schedule.chs" #-}


{-# LINE 58 "./QuantLib/Time/Schedule.chs" #-}


{-# LINE 59 "./QuantLib/Time/Schedule.chs" #-}


-- |Constructs a day counter of the given type and (where applicable) convention.
qlDayCounter :: (Int) -> (Int) -> IO ((DayCounter))
qlDayCounter a1 a2 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  preErrorCheck $ \a3' -> 
  qlDayCounter'_ a1' a2' a3' >>= \res ->
  peekDayCounter res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 62 "./QuantLib/Time/Schedule.chs" #-}


-- |Business/252 day count convention, counting business days per the given calendar.
qlDayCounterBusiness252 :: (Calendar) -> IO ((DayCounter))
qlDayCounterBusiness252 a1 =
  withCalendar a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlDayCounterBusiness252'_ a1' a2' >>= \res ->
  peekDayCounter res >>= \res' ->
  errorCheck  a2'>>
  return (res')

{-# LINE 65 "./QuantLib/Time/Schedule.chs" #-}


-- |Actual/Actual (Bond) day counter, using the given schedule's reference periods.
actualActualBond' :: (Schedule) -> IO ((DayCounter))
actualActualBond' a1 =
  withSchedule a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  actualActualBond''_ a1' a2' >>= \res ->
  peekDayCounter res >>= \res' ->
  errorCheck  a2'>>
  return (res')

{-# LINE 68 "./QuantLib/Time/Schedule.chs" #-}


-- |Actual/Actual (ISMA) day counter, using the given schedule's reference periods.
actualActualISMA' :: (Schedule) -> IO ((DayCounter))
actualActualISMA' a1 =
  withSchedule a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  actualActualISMA''_ a1' a2' >>= \res ->
  peekDayCounter res >>= \res' ->
  errorCheck  a2'>>
  return (res')

{-# LINE 71 "./QuantLib/Time/Schedule.chs" #-}


dayCounter :: DayCounterConstructor -> IO DayCounter
dayCounter (Business252 x) = qlDayCounterBusiness252 x
dayCounter (ActualActualBond' sched) = actualActualBond' sched
dayCounter (ActualActualISMA' sched) = actualActualISMA' sched
dayCounter x = uncurry qlDayCounter $ mapDayCounter x

-- |Returns the number of days between two dates.
days :: (DayCounter) -> (Day) -> (Day) -> IO ((Int))
days a1 a2 a3 =
  withDayCounter a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  days'_ a1' a2' a3' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 80 "./QuantLib/Time/Schedule.chs" #-}


-- |Returns the period between two dates as a fraction of year.
yearFraction :: (DayCounter) -> (Day) -> (Day) -> (Maybe Day) -- ^refPeriodStart
 -> (Maybe Day) -- ^refPeriodEnd
 -> IO ((Double))
yearFraction a1 a2 a3 a4 a5 =
  withDayCounter a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  withMaybeDay a4 $ \a4' -> 
  withMaybeDay a5 $ \a5' -> 
  preErrorCheck $ \a6' -> 
  yearFraction'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a6'>>
  return (res')

{-# LINE 86 "./QuantLib/Time/Schedule.chs" #-}


-- |Builds a payment schedule by generating dates between effective and termination dates according to the given tenor and rule.
schedule :: (Maybe Day) -- ^effectiveDate
 -> (Day) -- ^terminationDate
 -> ((Word,TimeUnit)) -- ^tenor
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (BusinessDayConvention) -- ^terminationDateConvention
 -> (DateGenerationRule) -- ^rule
 -> (Bool) -- ^endOfMonth
 -> (Maybe Day) -- ^firstDate
 -> (Maybe Day) -- ^nextToLastDate
 -> IO ((Schedule))
schedule a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
  withMaybeDay a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  let {(a3'1, a3'2) = fromEnumQuantity a3} in 
  withCalendar a4 $ \a4' -> 
  let {a5' = fromEnumC a5} in 
  let {a6' = fromEnumC a6} in 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  let {a8' = C2HSImp.fromBool a8} in 
  withMaybeDay a9 $ \a9' -> 
  withMaybeDay a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  schedule'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
  peekSchedule res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 99 "./QuantLib/Time/Schedule.chs" #-}


-- |Builds a payment schedule from an explicit list of dates, without checking them for plausibility.
fromDates :: ([Day]) -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Maybe BusinessDayConvention) -- ^terminationDateConvention
 -> (Maybe (Word, TimeUnit)) -- ^tenor
 -> (Maybe DateGenerationRule) -- ^rule
 -> (Maybe Bool) -- ^endOfMonth
 -> IO ((Schedule))
fromDates a1 a2 a3 a4 a5 a6 a7 =
  withDayArray a1 $ \(a1'1, a1'2) -> 
  withCalendar a2 $ \a2' -> 
  let {a3' = fromEnumC a3} in 
  let {a4' = fromMaybeEnum a4} in 
  let {(a5'1, a5'2) = fromMaybeEnumQuantity a5} in 
  let {a6' = fromMaybeEnum a6} in 
  let {a7' = fromMaybeBool a7} in 
  preErrorCheck $ \a8' -> 
  fromDates'_ a1'1  a1'2 a2' a3' a4' a5'1  a5'2 a6' a7' a8' >>= \res ->
  peekSchedule res >>= \res' ->
  errorCheck  a8'>>
  return (res')

{-# LINE 109 "./QuantLib/Time/Schedule.chs" #-}


-- |truncated schedule
-- TODO Introduce another Schedule type with restricted interface?
-- moreover, a fixed rate bond can be constructed from a full schedule only!
until :: (Schedule) -> (Day) -> IO ((Schedule))
until a1 a2 =
  withSchedule a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  until'_ a1' a2' a3' >>= \res ->
  peekSchedule res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 114 "./QuantLib/Time/Schedule.chs" #-}


-- |returns the dates for the given Schedule object
dates :: (Schedule) -> IO (([Day]))
dates a1 =
  withSchedule a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preErrorCheck $ \a3' -> 
  dates'_ a1' a2'1  a2'2 a3' >>
  peekDayArray  a2'1  a2'2>>= \a2'' -> 
  errorCheck  a3'>>
  return (a2'')

{-# LINE 117 "./QuantLib/Time/Schedule.chs" #-}


-- |returns a Period from a given Frequency (e.g. 6M from SemiAnnual)
fromFrequency :: (Frequency) -> IO ((Word), (TimeUnit))
fromFrequency a1 =
  let {a1' = (fromIntegral . fromEnum) a1} in 
  preEnum $ \a2' -> 
  preErrorCheck $ \a3' -> 
  fromFrequency'_ a1' a2' a3' >>= \res ->
  let {res' = fromIntegral res} in
  peekEnum  a2'>>= \a2'' -> 
  errorCheck  a3'>>
  return (res', a2'')

{-# LINE 120 "./QuantLib/Time/Schedule.chs" #-}


-- |returns a Frequency from a given Period (e.g. SemiAnnual from 6M)
toFrequency :: (Word,TimeUnit) -> IO ((Frequency))
toFrequency a1 =
  let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  preErrorCheck $ \a2' -> 
  toFrequency'_ a1'1  a1'2 a2' >>= \res ->
  let {res' = (toEnum . fromIntegral) res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 123 "./QuantLib/Time/Schedule.chs" #-}


-- |Parses a period from its short-format string representation (e.g. \"6M\").
parse :: (String) -> IO ((Int), (TimeUnit))
parse a1 =
  C2HSImp.withCString a1 $ \a1' -> 
  preEnum $ \a2' -> 
  preErrorCheck $ \a3' -> 
  parse'_ a1' a2' a3' >>= \res ->
  let {res' = fromIntegral res} in
  peekEnum  a2'>>= \a2'' -> 
  errorCheck  a3'>>
  return (res', a2'')

{-# LINE 126 "./QuantLib/Time/Schedule.chs" #-}


addPeriods :: (Int,TimeUnit) -> (Int,TimeUnit) -> IO ((Int), (TimeUnit))
addPeriods a1 a2 =
  let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  preEnum $ \a3' -> 
  preErrorCheck $ \a4' -> 
  addPeriods'_ a1'1  a1'2 a2'1  a2'2 a3' a4' >>= \res ->
  let {res' = fromIntegral res} in
  peekEnum  a3'>>= \a3'' -> 
  errorCheck  a4'>>
  return (res', a3'')

{-# LINE 128 "./QuantLib/Time/Schedule.chs" #-}


-- |Adds two periods together.
add :: (Int, TimeUnit) -> (Int, TimeUnit) -> IO (Int, TimeUnit)
add = addPeriods

-- |Divides a period's length by an integer divisor.
divide :: (Int,TimeUnit) -> (Int) -> IO ((Int), (TimeUnit))
divide a1 a2 =
  let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  let {a2' = fromIntegral a2} in 
  preEnum $ \a3' -> 
  preErrorCheck $ \a4' -> 
  divide'_ a1'1  a1'2 a2' a3' a4' >>= \res ->
  let {res' = fromIntegral res} in
  peekEnum  a3'>>= \a3'' -> 
  errorCheck  a4'>>
  return (res', a3'')

{-# LINE 135 "./QuantLib/Time/Schedule.chs" #-}


-- |Compares two periods, converting to a common time unit as needed.
lessThan :: (Int,TimeUnit) -> (Int,TimeUnit) -> IO ((Bool))
lessThan a1 a2 =
  let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  preErrorCheck $ \a3' -> 
  lessThan'_ a1'1  a1'2 a2'1  a2'2 a3' >>= \res ->
  let {res' = C2HSImp.toBool res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 138 "./QuantLib/Time/Schedule.chs" #-}


-- |Normalizes a period to the coarsest equivalent time unit (e.g. 12M to 1Y).
normalize :: (Int,TimeUnit) -> IO ((Int), (TimeUnit))
normalize a1 =
  let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  preEnum $ \a2' -> 
  preErrorCheck $ \a3' -> 
  normalize'_ a1'1  a1'2 a2' a3' >>= \res ->
  let {res' = fromIntegral res} in
  peekEnum  a2'>>= \a2'' -> 
  errorCheck  a3'>>
  return (res', a2'')

{-# LINE 141 "./QuantLib/Time/Schedule.chs" #-}


-- Same NOINLINE reasoning as QuantLib.Time.Calendar's own unsafeCalendar (which this can't
-- reuse: DayCounterConstructor's Read instance needs its own top-level NOINLINE binding, not
-- a shared one, so GHC can't float/duplicate-inline this call site independently of that
-- one's).
unsafeCalendar :: CalendarConstructor -> Calendar
unsafeCalendar = unsafePerformIO . calendar
{-# NOINLINE unsafeCalendar #-}

-- Hand-written, not `deriving`/TH-spliced: DayCounterConstructor's Business252 case carries a
-- live Calendar field (see QuantLib.Internal.Syntax.deriveReadPlain's comment for why the
-- generated part is spliced back in CalendarEnum.chs instead of here).
-- ActualActualBond'/ActualActualISMA' carry a Schedule, which has no small enum-shaped
-- readable proxy at all -- they get no alternative here, so parsing their name deliberately
-- falls through to the standard Read "no parse" failure.
instance Read DayCounterConstructor where
  readsPrec :: Int -> ReadS DayCounterConstructor
readsPrec Int
d String
r = Int -> ReadS DayCounterConstructor
readDayCounterConstructorPlain Int
d String
r
    [(DayCounterConstructor, String)]
-> [(DayCounterConstructor, String)]
-> [(DayCounterConstructor, String)]
forall a. [a] -> [a] -> [a]
++ Bool -> ReadS DayCounterConstructor -> ReadS DayCounterConstructor
forall a. Bool -> ReadS a -> ReadS a
readParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (\String
r' ->
         [ (Calendar -> DayCounterConstructor
Business252 Calendar
c, String
s1)
         | (String
"Business252", String
s0) <- ReadS String
lex String
r'
         , (CalendarConstructor
p, String
s1) <- Int -> ReadS CalendarConstructor
forall a. Read a => Int -> ReadS a
readsPrec Int
11 String
s0, let c :: Calendar
c = CalendarConstructor -> Calendar
unsafeCalendar CalendarConstructor
p
         ]) String
r

-- vim: set ff=unix ts=8 sts=2 sw=2 et:

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounter"
  qlDayCounter'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDayCounter))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounterBusiness252"
  qlDayCounterBusiness252'_ :: ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDayCounter)))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounterActualActualBond"
  actualActualBond''_ :: ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDayCounter)))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounterActualActualISMA"
  actualActualISMA''_ :: ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CDayCounter)))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounterDayCount"
  days'_ :: ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO C2HSImp.CInt))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlDayCounterYearFraction"
  yearFraction'_ :: ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlSchedule"
  schedule'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSchedule)))))))))))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlSchedule1"
  fromDates'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSchedule)))))))))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlScheduleUntil"
  until'_ :: ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSchedule))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlScheduleDates"
  dates'_ :: ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodFromFrequency1"
  fromFrequency'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodToFrequency1"
  toFrequency'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodParserParse1"
  parse'_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodAdd1"
  addPeriods'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt)))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodDivide1"
  divide'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodsLT1"
  lessThan'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt))))))

foreign import ccall safe "QuantLib/Time/Schedule.chs.h qlPeriodNormalize1"
  normalize'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt)))))