Skip to content

Instantly share code, notes, and snippets.

View axelGschaider's full-sized avatar

Axel Gschaider axelGschaider

  • Vienna, Austria
View GitHub Profile

Keybase proof

I hereby claim:

  • I am axelGschaider on github.
  • I am agschaid (https://keybase.io/agschaid) on keybase.
  • I have a public key whose fingerprint is 8689 ADBA E570 42F1 6171 7918 0AB7 4AB7 8969 A17A

To claim this, I am signing this object:

@axelGschaider
axelGschaider / Bad.scala
Last active January 3, 2016 04:28
There has got to be a better way
trait Model[A <: Model[A]] {
val internalKey:String
def key:Key[A] = Key[A](internalKey)
// removed this function because it did not make my intent clear.
// def isThatYou(k:Key[A]) = key == k
}
case class Key[A <: Model[A]]( keyVal:String )
@axelGschaider
axelGschaider / xmonad.hs
Last active December 11, 2015 02:18
just my xmonad.hs
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig
import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.NoBorders
import XMonad.Layout.Named
import XMonad.Hooks.DynamicLog
@axelGschaider
axelGschaider / Rocket.hs
Created August 31, 2012 19:32
The infamous rocket example for phantom types. With support for real oxygen/fuel data
data NoFuel
data Fueled
data NoO2
data HasO2
data Rocket fuel o2 = Rocket { fuel:: Int
, o2 :: Int }
createRocket :: Rocket NoFuel NoO2
import Data.Monoid
--This is sparta! Filter the 500!
sparta :: (Integer -> Bool) -> [Integer]
sparta = flip filter [1 .. 500]
-- now the question is: how can multiple clauses for the same Integer be combined?
(<&&>) :: (a -> Bool) -> (a -> Bool) -> (a -> Bool)
f <&&> g = \x -> f x && g x