Last active
December 29, 2015 06:59
-
-
Save gatlin/7632557 to your computer and use it in GitHub Desktop.
A point-free (pointless?) little program to calculate how much to invoice clients to get a desired amount after Stripe's fees.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System.Environment | |
main :: IO () | |
main = getArgs >>= parse >>= display . roundMoney . charge | |
charge :: Fractional a => a -> a | |
charge = (/ 0.971) . (+ 0.3) | |
display :: Show a => a -> IO () | |
display = putStrLn . show | |
parse :: (Monad m, Read b) => [String] -> m b | |
parse = return . read . flip (!!) 0 | |
roundMoney :: RealFrac f => f -> f | |
roundMoney = (/ 10.0 ^^ 2) . fromInteger . round . (100 *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment