Commit f141e2da authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Init with Pi

parent 085e0921
# ---> Haskell
*.template
pages/
out/
*.cabal
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
.vscode
cradle:
stack:
name: experiments
dependencies:
- base
executables:
pi:
main: Main.hs
source-dirs: pi
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
module Main where
main :: IO ()
main = print $ Main.pi 1000000000
pi :: Int -> Double
pi n = let dx = (1/fromIntegral n) in sum $ do
i <- fromIntegral <$> [0..n]
let x = (i+0.5) * dx
return $ dx * f x
f :: Double -> Double
f x = 4 / (1 + x * x)
resolver: lts-17.9
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
snapshots:
- original: lts-17.9
completed:
sha256: d7d8d5106e53d1669964bd8bd2b0f88a5ad192d772f5376384b76738fd992311
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/9.yaml
size: 567037
packages: []
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment