Skip to content

Instantly share code, notes, and snippets.

Someone here is possessed by an owl. Who?

Oleg Grenrus phadej

Someone here is possessed by an owl. Who?
View GitHub Profile
View Param.hs
module Param where
data Param = Param {
param1 :: Int,
param2 :: Int,
param3 :: Int,
param4 :: Int,
param5 :: Int,
param6 :: Int,
param7 :: Int,
phadej / Algebra.hs
Last active Aug 29, 2015
Typeclasses in JavaScript.
View Algebra.hs
{-# LANGUAGE RankNTypes #-}
module Algebra where
data Monoid a = Monoid {
zero :: a,
op :: a -> a -> a
data Foldable f = Foldable {
fold :: forall a. Monoid a -> f a -> a
phadej /
Created Feb 15, 2014
beautiful-docs bug

My file

# comment
phadej / Foo.hs
Last active Aug 29, 2015
Identity in haskell...
View Foo.hs
module Main where
import Unsafe.Coerce
-- ideq is strict in its parameters
ideq :: a -> a -> Bool
ideq a b = a `seq` b `seq` aid == bid
where aid = unsafeCoerce a :: Int
bid = unsafeCoerce b :: Int
View MonoidalCategory.hs
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TupleSections #-}
import Prelude hiding (fst, snd, curry, uncurry, (.))
import Control.Category
import Data.Void
import Control.Arrow (Kleisli(..), arr)
class Category cat => MonoidalCategory cat p u | p -> u where
View bacon.js
var Bacon = require("baconjs");
var aBus = new Bacon.Bus();
a = aBus.toProperty(3);
b = (x) { return x * 2; });
c = (x) { return x * 3; });
d = Bacon.combineWith(function (x, y) { return x + y; }, b, c);
# if we have haskell installed
command -v runhaskell > /dev/null 2>&1
if [ $? ]; then
# Embedded haskell
TMP=`mktemp /tmp/orderpath.XXXXXX`
cat > $TMP <<'EOF'
module Main where
import System.Environment (getEnvironment)
View error.txt
No instance for (Ord a0) arising from a use of ‘sort_idemp’
The type variable ‘a0’ is ambiguous
Note: there are several potential instances:
phadej /
Created Jul 17, 2014
Result of watching to much #OPLSS videos

CSS. Cascading Style Sheets. What are they?

Wikipedia says:

Cascading Style Sheets (CSS) is a style sheet language used for describing...

And one important observation: there are no abstraction mechanism in CSS. CSS expression evaluates to itself. Thus CSS is not very fascinating as a programming language.

There are sass, lesscss and others. They add some abbstractions mechanisms, notably variables and mixins (which are kind-of-functions). Yet I don't like them as languages, they are barely macro systems.

It would be nice to have pure (do you really need side-effects while generating CSS?) typed, well-designed CSS abstraction language.

View TicTacToe.agda
module TicTacToe where
open import Prelude
open import Data.List
-- TicTacToe it is!
-- There is two players
data Player : Set where
X O : Player