Skip to content

Instantly share code, notes, and snippets.

View funrep's full-sized avatar

Karl-Oskar Rikås funrep

View GitHub Profile
#lang racket
(define (fib n)
(if (< n 2)
n
(+ (fib (- n 1)) (fib (- n 2)))))
(display (fib 10))
(display "\n")
@funrep
funrep / bf3.hs
Created September 14, 2013 13:37
How to make AAA 3D games in Haskell
import Game.AAAGameDevEnv (GameEngine (..), GameData (..))
main = frostbite $ bf3
frostbite :: GameData -> GameEngine
frostbite game = Engine {
version = 2.3.2,
directX = yes,
realLifePhysics = enabled,
gameStuff = game
@funrep
funrep / cookies.hs
Last active December 22, 2015 22:09
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Web.ClientSession
import Data.Text.Lazy (Text, toStrict, fromStrict)
import Data.Text.Lazy.Encoding (encodeUtf8, decodeUtf8)
import Data.ByteString (ByteString)
import Data.Monoid ((<>))
$ ghc --make acid.hs
[1 of 1] Compiling Main ( acid.hs, acid.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package bytestring-0.10.2.0 ... linking ... done.
Loading package containers-0.5.2.1 ... linking ... done.
{-# LANGUAGE DeriveDataTypeable, TypeFamilies, TemplateHaskell #-}
module Main (main) where
import Data.Acid
import Control.Monad.State
import Control.Monad.Reader
import System.Environment
import Data.SafeCopy
checkSyntax :: Int -> BFSrc -> BFSrc
checkSyntax b [] = []
checkSyntax b (x@LoopL:xs) = x : checkSyntax (b + 1) xs
checkSyntax b (x@LoopR:xs) = x : checkSyntax (b - 1) xs
checkSyntax b (x:xs) = x : checkSyntax b xs
August 21, 2013 19:26
I got this in my inbox:
"No one is denying there are serious security flaws here which ought to be addressed, but this is just silly. @klrr, if this is your idea of contributing to the Haskell community (re: our discussion in IRC), you need to rethink your approach. Creating fake accounts just to trump up some pet issue with implausible stories is not acceptable behavior." - Brent Yorgey
The person in qusetion had commentated this on github.
Earlier that day someone posted this to Helm (which is a game engine I've contributed to) https://github.com/z0w0/helm/issues/38
Uxvt.scrollBar: false
Uxvt*font: xft:terminus-font:size:12
!TomorrowNightEighties
#define t_background #2d2d2d
#define t_current_line #393939
#define t_selection #515151
#define t_foreground #cccccc
#define t_comment #999999

Which of the following statements are true?

  1. All natural numbers are rational numbers. 1. expression 2. expression2

My answers:

  1. False
  2. False
  3. False
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
import Control.Applicative
import FRP.Elerea.Simple
import GHC.Float
import FRP.Helm hiding (join, x, y)
import Control.Monad
import Control.Arrow ((&&&), first, second)