The original code (~7.2s on my laptop).
import System.Random
import System.CPUTime
rainfall :: [Int] -> Int
rainfall xs = sum (zipWith (-) mins xs)
{-# LANGUAGE RankNTypes #-} | |
import Numeric.Natural (Natural) | |
import Numeric.AD (diff) | |
newtonRoot | |
:: (Floating a, Ord a) | |
=> Natural -- ^ iterations | |
-> a -- ^ epsilon | |
-> a -- ^ starting guess |
The original code (~7.2s on my laptop).
import System.Random
import System.CPUTime
rainfall :: [Int] -> Int
rainfall xs = sum (zipWith (-) mins xs)
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE PartialTypeSignatures #-} | |
module RegAlloc1 | |
( -- * Types | |
Var |
This is intended as a reply to https://ro-che.info/articles/2017-06-12-friendly-contributing-policies, but I don't really want it to be a blog post (it's not the right level for my blog), and that blog doesn't have comments, and I don't want to mis-express myself in 120 characters or whatever. So here goes a gist :)
Firstly, as to the talk, the context was read around the project, and figure out if it will suit you. I am deliberately quoting haskell-src-exts out of context, and deliberately not saying where either quote came from. I appreciate the full policy is much more welcoming than that one snippet would imply.
However, when I wanted to find an unfriendly contributing policy, I immediately thought of haskell-src-exts. I do genuinely find the document, as a whole, quite unwelcoming. I appreciate that languages sound different to native speakers, and it didn't stop me contributing, but it did give me pause. Whether a document is friendly or not is a feeling, and so by explaining why I have that feeling
{-# LANGUAGE TemplateHaskell #-} | |
-- | For when you have a record that doesn't have lenses derived for | |
-- it and you need a lens, just use @$(lens 'thefield)@ and away you go. | |
module Control.Lens.FieldTH where | |
import Language.Haskell.TH | |
lens :: Name -> Q Exp | |
lens name = do | |
[|\f r -> | |
fmap | |
$(lamE |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Network.Wai (pathInfo, Request, requestMethod, Response, responseLBS, ResponseReceived) | |
import Network.Wai.Handler.Warp (run) | |
import Network.HTTP.Types (status200, status401) | |
-- note: type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived | |
application :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived |
#!/usr/bin/env bash | |
if [[ -z "$1" ]]; then | |
echo "No filter given, abort" | |
exit 1 | |
fi | |
tmp=$(mktemp -d) | |
jq="$tmp/jq" |
Find it here: https://github.com/bitemyapp/learnhaskell
Git checkout
can do almost anything ... or, at least, many things. It can switch branches. It can mix and match branches. It can resolve merge conflicts. It can give you a scratchpad to test things. It can even be used to interactively patch files. It's so powerful because it's so abstract. But much like numinous mystics, abstraction makes it confusing.
Basically git checkout
does two things: