Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View phadej's full-sized avatar
🦉
Someone here is possessed by an owl. Who?

Oleg Grenrus phadej

🦉
Someone here is possessed by an owl. Who?
View GitHub Profile
module Param where
data Param = Param {
param1 :: Int,
param2 :: Int,
param3 :: Int,
param4 :: Int,
param5 :: Int,
param6 :: Int,
param7 :: Int,
@phadej
phadej / Algebra.hs
Last active August 29, 2015 13:56
Typeclasses in JavaScript.
{-# 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
phadej / coffee.md
Created February 15, 2014 00:12
beautiful-docs bug

My file

# comment
@phadej
phadej / Foo.hs
Last active August 29, 2015 13:57
Identity in haskell...
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
{-# 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
var Bacon = require("baconjs");
var aBus = new Bacon.Bus();
a = aBus.toProperty(3);
b = a.map(function (x) { return x * 2; });
c = a.map(function (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)
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
phadej / typed-css.md
Created July 17, 2014 14:43
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.

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