-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.


{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}

module Duckling.AmountOfMoney.NB.Rules
  ( rules
  ) where

import Data.Maybe
import Data.String
import Prelude

import Duckling.AmountOfMoney.Helpers
import Duckling.AmountOfMoney.Types (Currency (..), AmountOfMoneyData (..))
import Duckling.Dimensions.Types
import Duckling.Numeral.Helpers (isNatural, isPositive)
import Duckling.Numeral.Types (NumeralData (..))
import Duckling.Types
import qualified Duckling.AmountOfMoney.Types as TAmountOfMoney
import qualified Duckling.Numeral.Types as TNumeral

ruleUnitAmount :: Rule
ruleUnitAmount :: Rule
ruleUnitAmount = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"<unit> <amount>"
  , pattern :: Pattern
pattern =
    [ Predicate -> PatternItem
Predicate Predicate
isCurrencyOnly
    , Predicate -> PatternItem
Predicate Predicate
isPositive
    ]
  , prod :: Production
prod = \case
      (Token Dimension a
AmountOfMoney AmountOfMoneyData{TAmountOfMoney.currency = c}:
       Token Dimension a
Numeral NumeralData{TNumeral.value = v}:
       [Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token)
-> (AmountOfMoneyData -> AmountOfMoneyData)
-> AmountOfMoneyData
-> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> AmountOfMoneyData -> AmountOfMoneyData
withValue Double
v (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
c
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleIntersectAndNumeral :: Rule
ruleIntersectAndNumeral :: Rule
ruleIntersectAndNumeral = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"intersect (and number)"
  , pattern :: Pattern
pattern =
    [ Predicate -> PatternItem
Predicate Predicate
isWithoutCents
    , String -> PatternItem
regex String
"og"
    , Predicate -> PatternItem
Predicate Predicate
isNatural
    ]
  , prod :: Production
prod = \case
      (Token Dimension a
AmountOfMoney a
fd:
       Token
_:
       Token Dimension a
Numeral NumeralData{TNumeral.value = c}:
       [Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Double -> AmountOfMoneyData -> AmountOfMoneyData
withCents Double
c a
AmountOfMoneyData
fd
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleAboutAmountofmoney :: Rule
ruleAboutAmountofmoney :: Rule
ruleAboutAmountofmoney = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"about <amount-of-money>"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"omtrent|cirka|rundt|ca"
    , Predicate -> PatternItem
Predicate Predicate
isMoneyWithValue
    ]
  , prod :: Production
prod = \case
      (Token
_:Token
token:[Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just Token
token
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleCent :: Rule
ruleCent :: Rule
ruleCent = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"cent"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"cent(?:\\b|s)|\\bc\\b|pen(?:ce|ny|nies)|\\bp\\b|(?:ø|ö)rer?|fen|haleru|groszy|pais(?:e|a)\
           \|centesim(?:o|i)|centimes?|\\bct?\\b|\\brp?\\b|rap(?:pen)?s?|satang"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
Cent
  }

ruleIntersectXCents :: Rule
ruleIntersectXCents :: Rule
ruleIntersectXCents = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"intersect (X cents)"
  , pattern :: Pattern
pattern =
    [ Predicate -> PatternItem
Predicate Predicate
isWithoutCents
    , Predicate -> PatternItem
Predicate Predicate
isCents
    ]
  , prod :: Production
prod = \case
      (Token Dimension a
AmountOfMoney a
fd:
       Token Dimension a
AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
       [Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Double -> AmountOfMoneyData -> AmountOfMoneyData
withCents Double
c a
AmountOfMoneyData
fd
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleNok :: Rule
ruleNok :: Rule
ruleNok = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"NOK"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:norske? ?)?kr(?:oner?)?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
NOK
  }

rulePound :: Rule
rulePound :: Rule
rulePound = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"£"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"po?und?s?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
Pound
  }

ruleIntersectAndXCents :: Rule
ruleIntersectAndXCents :: Rule
ruleIntersectAndXCents = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"intersect (and X cents)"
  , pattern :: Pattern
pattern =
    [ Predicate -> PatternItem
Predicate Predicate
isWithoutCents
    , String -> PatternItem
regex String
"og"
    , Predicate -> PatternItem
Predicate Predicate
isCents
    ]
  , prod :: Production
prod = \case
      (Token Dimension a
AmountOfMoney a
fd:
       Token
_:
       Token Dimension a
AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
       [Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Double -> AmountOfMoneyData -> AmountOfMoneyData
withCents Double
c a
AmountOfMoneyData
fd
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleIntersect :: Rule
ruleIntersect :: Rule
ruleIntersect = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"intersect"
  , pattern :: Pattern
pattern =
    [ Predicate -> PatternItem
Predicate Predicate
isWithoutCents
    , Predicate -> PatternItem
Predicate Predicate
isNatural
    ]
  , prod :: Production
prod = \case
      (Token Dimension a
AmountOfMoney a
fd:
       Token Dimension a
Numeral NumeralData{TNumeral.value = c}:
       [Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Double -> AmountOfMoneyData -> AmountOfMoneyData
withCents Double
c a
AmountOfMoneyData
fd
      [Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
  }

ruleDirham :: Rule
ruleDirham :: Rule
ruleDirham = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"AED"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"dirhams?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
AED
  }

ruleSEK :: Rule
ruleSEK :: Rule
ruleSEK = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"SEK"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:svenske? )?kron(?:a|or)|svenske? kr(?:oner?)?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
SEK
  }

ruleGBP :: Rule
ruleGBP :: Rule
ruleGBP = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"GBP"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:britiske?|engelske?) po?unds?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
GBP
  }

ruleDKK :: Rule
ruleDKK :: Rule
ruleDKK = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"DKK"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"danske? kr(?:oner?)?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
DKK
  }

ruleUSD :: Rule
ruleUSD :: Rule
ruleUSD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"USD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"amerikanske? dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
USD
  }

ruleAUD :: Rule
ruleAUD :: Rule
ruleAUD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"AUD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"australske? dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
AUD
  }

ruleCAD :: Rule
ruleCAD :: Rule
ruleCAD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"CAD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:k|c)anadiske? dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
CAD
  }

ruleCHF :: Rule
ruleCHF :: Rule
ruleCHF = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"CHF"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"sveitsiske? francs?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
CHF
  }

ruleCNY :: Rule
ruleCNY :: Rule
ruleCNY = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"CNY"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:kinesiske? )?(?:yuan|renminbi)"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
CNY
  }

ruleCZK :: Rule
ruleCZK :: Rule
ruleCZK = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"CZK"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:tsjekkiske? )?koruna"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
CZK
  }

ruleHKD :: Rule
ruleHKD :: Rule
ruleHKD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"HKD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"hong kong dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
HKD
  }

ruleINR :: Rule
ruleINR :: Rule
ruleINR = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"INR"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:indiske? )?rup(?:i(?:er)?|ees?)"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
INR
  }

ruleJPY :: Rule
ruleJPY :: Rule
ruleJPY = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"JPY"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"japanske? yen"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
JPY
  }

ruleNZD :: Rule
ruleNZD :: Rule
ruleNZD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"NZD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:nz|new zealand(?:ske)?) dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
NZD
  }

rulePKR :: Rule
rulePKR :: Rule
rulePKR = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"PKR"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"pakistanske? rup(?:i(?:er)?|ees?)"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
PKR
  }

rulePLN :: Rule
rulePLN :: Rule
rulePLN = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"PLN"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:polske? )?(?:z|s)?lotys?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
PLN
  }

ruleSGD :: Rule
ruleSGD :: Rule
ruleSGD = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"SGD"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"singapor(?:e|ske?) dollars?"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
SGD
  }

ruleTHB :: Rule
ruleTHB :: Rule
ruleTHB = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"THB"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:thai(?:land(?:ske?)?)? )?b(?:ah|ha)t"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
THB
  }

ruleZAR :: Rule
ruleZAR :: Rule
ruleZAR = Rule :: Text -> Pattern -> Production -> Rule
Rule
  { name :: Text
name = Text
"ZAR"
  , pattern :: Pattern
pattern =
    [ String -> PatternItem
regex String
"(?:sør(?: |-)?afrika(?:nske?)? )?rand"
    ]
  , prod :: Production
prod = Maybe Token -> Production
forall a b. a -> b -> a
const (Maybe Token -> Production) -> Maybe Token -> Production
forall a b. (a -> b) -> a -> b
$ Token -> Maybe Token
forall a. a -> Maybe a
Just (Token -> Maybe Token) -> Token -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Dimension AmountOfMoneyData -> AmountOfMoneyData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension AmountOfMoneyData
AmountOfMoney (AmountOfMoneyData -> Token) -> AmountOfMoneyData -> Token
forall a b. (a -> b) -> a -> b
$ Currency -> AmountOfMoneyData
currencyOnly Currency
ZAR
  }

rules :: [Rule]
rules :: [Rule]
rules =
  [ Rule
ruleUnitAmount
  , Rule
ruleAboutAmountofmoney
  , Rule
ruleCent
  , Rule
ruleDirham
  , Rule
ruleIntersect
  , Rule
ruleIntersectAndNumeral
  , Rule
ruleIntersectAndXCents
  , Rule
ruleIntersectXCents
  , Rule
ruleNok
  , Rule
rulePound
  , Rule
ruleSEK
  , Rule
ruleDKK
  , Rule
ruleUSD
  , Rule
ruleAUD
  , Rule
ruleCAD
  , Rule
ruleGBP
  , Rule
ruleCHF
  , Rule
ruleCNY
  , Rule
ruleCZK
  , Rule
ruleHKD
  , Rule
ruleINR
  , Rule
ruleJPY
  , Rule
ruleNZD
  , Rule
rulePKR
  , Rule
rulePLN
  , Rule
ruleSGD
  , Rule
ruleTHB
  , Rule
ruleZAR
  ]