Skip to content

Instantly share code, notes, and snippets.

@conklech
conklech / gist:bba5c73ebc153a6a411b
Last active August 29, 2015 14:14
Setting up a Haskell development environment with Nix and VirtualBox
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveFoldable, DeriveTraversable #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Applicative
-- Initial buildtools-test.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: buildtools-test
version: 0.1.0.0
-- synopsis:
-- description:
-- license:
license-file: LICENSE
author: Christian Conkle
@conklech
conklech / gist:2004292
Created March 9, 2012 00:18
Loading data slowly over CaseMap COM interface
#r @"Casemap.dll" // Generated from casemap.exe with tlbimp.exe
#r @"StdVCL.dll"
open System.Runtime.InteropServices
let getFieldRows (data : Casemap.IDataSet) (field : Casemap.IDataField2) =
let userLocation = data.BookmarkCreate()
data.MoveFirst ()
[ yield field.Value
while data.MoveNext() do
yield field.Value
{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
module SeerA (SeerA, runSeerA, see, send, contact) where
import Control.Applicative
import Control.Applicative.Trans
import Data.Functor.Constant
import Data.Functor.Product
import Data.Monoid (Monoid, mempty, (<>), Sum(..))
@conklech
conklech / Main.hs
Last active December 29, 2015 18:49
{-# LANGUAGE StandaloneDeriving, FlexibleInstances, FlexibleContexts, UndecidableInstances, DeriveFunctor, GADTs, DataKinds, KindSignatures, TypeFamilies, PolyKinds, RankNTypes, ConstraintKinds, MultiParamTypeClasses, TypeOperators, ScopedTypeVariables, RecursiveDo, OverlappingInstances #-}
module Main where
import Data.Functor.Identity
import Data.Functor.Compose
import Data.Functor.Constant
import Data.Functor.Product
import Control.Applicative
import Data.Vinyl
@conklech
conklech / TestInline.hs
Last active December 30, 2015 07:29
Demonstration of unrolled vinyl lenses
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
module TestInline (modified, modified_field2, with_field2, get_field2, get_nolens) where
import Data.Vinyl
import Data.Functor.Identity
-- compile with
-- cabal build --ghc-option=-ddump-simpl --ghc-option=-dsuppress-all --ghc-option=-O2
type Field1 = "Field1" ::: String
$ ob run
warning: in configuration file '/etc/nix/nix.conf': unknown setting 'trusted-public-keys'
building '/nix/store/d5pnf3knrd73kvr1zz0ydm4k8rkpwcs0-source.drv'...
trying https://github.com/obsidiansystems/obelisk/archive/ffce7c5f17e164f64cdae15895b30cefebbd7095.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 165 0 165 0 0 632 0 --:--:-- --:--:-- --:--:-- 632
100 130k 0 130k 0 0 216k 0 --:--:-- --:--:-- --:--:-- 216k
unpacking source archive /private/tmp/nix-build-source.drv-0/ffce7c5f17e164f64cdae15895b30cefebbd7095.tar.gz
$ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command
unpacking 'https://github.com/obsidiansystems/obelisk/archive/master.tar.gz'...
building '/nix/store/dlyn7wzl825ks2h0wpk19mg8qf0kkv8v-cabal2nix-obelisk-command.drv'...
installing
replacing old 'obelisk-command-0.1'
installing 'obelisk-command-0.1'
these derivations will be built:
/nix/store/lx03y7g388cg1zdfal3qvv3v7riz1ssi-optparse-applicative-0.14.0.0.drv
/nix/store/51pzlz7b2s9nh3afcwpmk2r341dymfr3-tasty-0.11.2.5.drv
/nix/store/d67ip5wfchmw2jdx81z48235aa2yhk2i-tasty-hunit-0.9.2.drv
@conklech
conklech / Build Output
Created November 17, 2018 21:13
Minimal test case for deep+ failure with LDF
> Executing task: C:\Users\chris\.platformio\penv\Scripts\platformio.exe run --verbose <
Processing megaatmega2560 (platform: atmelavr; lib_ldf_mode: deep+; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz 8KB RAM (248KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(deep+) COMPATIBILITY(soft)
Collected 24 compatible libraries