27H4DECZW4CEDSV5XYJQA5HOMUW73K5G2DBQNLQB7AFZXXVXCFCAC newtype Billable' t = Billable
recurrenceJSON :: Recurrence -> JsonrecurrenceJSON = case _ ofAnnually -> encodeJson $ { annually: {} }Monthly i -> encodeJson $ { monthly: i }Weekly i -> encodeJson $ { weekly: i }OneTime -> encodeJson $ { onetime: {} }type Billable =
type Billable = Billable' DateTime
billableJSON :: Billable -> JsonbillableJSON b = encodeJson ${ name: b.name, description: b.description, message: b.message, recurrence: recurrenceJSON b.recurrence, currency: "ZEC", amount: toNumber (unwrap b.amount)}
createBillable pid bid = pure $ Left Forbidden
createBillable pid billable = dolet body = RB.json $ billableJSON billableresponse <- post RF.json ("/api/projects/" <> pidStr pid <> "/billables") (Just body)runExceptT $ case response ofLeft err -> throwError $ Error { status: Nothing, message: printError err }Right r -> case r.status ofStatusCode 403 -> throwError $ ForbiddenStatusCode 200 -> withExceptT (ParseFailure r.body) <<< except $ decodeJson r.bodyother -> throwError $ Error { status: Just other, message: r.statusText }
newtype Zatoshi = Zatoshi Int
import Preludeimport Data.Newtype (class Newtype)import Data.BigInt (BigInt)import Data.Fixed (Fixed, P1000000, TenTimes)newtype Zatoshi = Zatoshi (BigInt)derive instance zatoshiEq :: Eq Zatoshiderive instance zatoshiOrd :: Ord Zatoshiderive instance zatoshiNewtype :: Newtype Zatoshi _type ZPrec = TenTimes (TenTimes P1000000)newtype ZEC = ZEC (Fixed ZPrec)derive instance zecEq :: Eq ZECderive instance zecOrd :: Ord ZECderive instance zecNewtype :: Newtype ZEC _