Skip to content

Instantly share code, notes, and snippets.

View mathiasverraes's full-sized avatar

Mathias Verraes mathiasverraes

View GitHub Profile
@mathiasverraes
mathiasverraes / setup.md
Created June 19, 2016 17:16
haskell intellij + stack setup

https://github.com/rikvdkleij/intellij-haskell

General setup

  • Install latest versions of ghc-mod and haskell-docs;
  • Set file paths to ghc-mod, hlint, stack and haskell-docs in the menu Settings/Other Settings/Haskell.
  • Be sure in Editor/Filetypes that Haskell language file is registered with pattern *.hs and Literate Haskell language file with pattern *.lhs;

Project

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//www.marudot.com//iCal Event Maker
X-WR-CALNAME:Domain-Driven Design Europe 2017
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
@mathiasverraes
mathiasverraes / Bowling.hs
Created March 20, 2016 03:16
Bowling Kata
module Bowling where
import Test.QuickCheck
import Data.List
data Frame =
Roll Int Int
| Spare Int Int
| SpareExtra Int
| Strike
https://github.com/gigasquid/wonderland-clojure-katas
http://exercism.io
http://archkatas.herokuapp.com
(define (f a b c)
(sum (map sq (max2 a b c)))
)
(define (biggest a b)
(if (> a b) a b)
)
(define (sq a) (* a a))
@mathiasverraes
mathiasverraes / declarative_code.hs
Last active September 11, 2015 12:33
Testing fizzbuzz
-- in reaction to http://codemanship.co.uk/parlezuml/blog/?postid=1325
-- oneHundredIntegersSeparatedByCommas
-- integersDivisibleByThreeReplacedWithFizz
-- integersDivisibleByFiveReplacedWithBuzz
-- integersDivisibleByThreeAndFiveReplaedWithFizzBuzz
-- remainingNumbersAreUnchanged
-- Imho No amount of tests can explain fizzbuzz better than a declarative implementation:
fizz :: Int -> String
@mathiasverraes
mathiasverraes / Collatz.hs
Created September 9, 2015 18:30
Collatz sequences in Haskell using a Writer monad. Not that you need one. For science!
module Collatz where
import Control.Monad.Writer
collatzSeq :: Integer -> Writer [Integer] Integer
collatzSeq n = do
n <- collatz n
if n==1 then return 1 else collatzSeq n
collatz :: Integer -> Writer [Integer] Integer
@mathiasverraes
mathiasverraes / phonenumbers.hs
Last active September 30, 2015 08:22
Phone Number Kata
-- Given a list of phone numbers, determine if it is consistent.
-- In a consistent phone list no number is a prefix of another. For example:
-- Bob 91 12 54 26
-- Alice 97 625 992
-- Emergency 911
-- In this case, it is not possible to call Bob because the phone exchange
-- would direct your call to the emergency line as soon as you dialled the
-- first three digits of Bob's phone number. So this list would not be consistent.
@mathiasverraes
mathiasverraes / jargon.md
Last active April 19, 2018 10:35 — forked from cb372/jargon.md
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@mathiasverraes
mathiasverraes / gist:ce93e6aa7dd7db75d772
Last active August 29, 2015 14:15
Add the requester's repo as a remote to yours - github

GitHub provides a special pulls remote "namespace" on the upstream repo, so you can add it as a fetch pattern to your .git/config like so:

    [remote "upstream"]
      url = https://github.com/neovim/neovim.git
      fetch = +refs/heads/*:refs/remotes/upstream/*
      fetch = +refs/pull/*/head:refs/pull/upstream/*

Then when you git fetch --all, you will have ALL pull requests available in your local repo in the local pull/ namespace. To check out PR #42: