Skip to content

Instantly share code, notes, and snippets.

@noinia
noinia / Object.hs
Last active August 29, 2015 14:06
More fiddling with Extendible types, Type functions, Pattern Synonyms etc.
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
@noinia
noinia / Compose.hs
Created October 13, 2014 17:32
Composition of closed Universes in Vinyl 0.5
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
module Compose where
import Data.Singletons
import Data.Singletons.TH
@noinia
noinia / SkewTree.hs
Created October 21, 2014 21:09
SkewTrees
type Height = Int
data SkewTree a = Empty
| TopNode !Height !(SkewTree a) a !(SkewTree a) !(SkewTree a)
| InternalNode !Height !(SkewTree a) a !(SkewTree a)
deriving (Show,Eq)
-- data SkewTree a = Empty
@noinia
noinia / TypeLevelSkewTree.hs
Last active August 29, 2015 14:13
Fiddling on type level skewtrees
-- type Height = Int
data SkewTree a = Empty
| InternalNode !(SkewTree a) a !(SkewTree a)
| TopNode !(SkewTree a) a !(SkewTree a) !(SkewTree a)
deriving (Show,Eq)
leaf a = InternalNode Empty a Empty
@noinia
noinia / corecs.hs
Last active August 29, 2015 14:22
CoRec as Open Union
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
module CoRecExtra where
import Data.Maybe(isJust, mapMaybe, listToMaybe, fromJust)
import Data.Proxy
import Data.Vinyl.Core
import Data.Vinyl.Functor
import Data.Vinyl.Lens
@noinia
noinia / CairoSimple.hs
Created August 10, 2017 08:25
Simple Cairo
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Exception (catch)
import Control.Monad (forM_)
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Trans.Reader (runReaderT)
import Data.GI.Base
@noinia
noinia / CairoSimple.hs
Created August 10, 2017 08:25
Simple Cairo
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Exception (catch)
import Control.Monad (forM_)
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Trans.Reader (runReaderT)
import Data.GI.Base
@noinia
noinia / CairoSimple.hs
Last active August 10, 2017 08:26
Simple gi-gtk + Cairo "hello world"-like application.
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Exception (catch)
import Control.Monad (forM_)
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Trans.Reader (runReaderT)
import Data.GI.Base
@noinia
noinia / stack error
Last active October 25, 2017 15:04
stack build error
frank@UU# rm -rf ~/.stack
frank@UU# stack setup
Writing implicit global project config file to: /home/frank/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-9.10
Downloaded lts-9.10 build plan.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading root
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
@noinia
noinia / stack error microlens
Created October 25, 2017 22:12
stack error microlens
frank@UU# stack install -v
Version 1.5.1 x86_64
Compiled with:
- Cabal-1.24.2.0
- Glob-0.8.0
- HUnit-1.6.0.0
- MonadRandom-0.5.1
- QuickCheck-2.10.1
- SHA-1.6.4.2
- StateVar-1.1.0.4