Skip to content

Instantly share code, notes, and snippets.

class Documented t where
doc :: t -> Display
instance Documented (Proxy TextWidget) where
doc Proxy = ...
instance Documented (Proxy Slider) where
doc Proxy = ...
-- usage
data DefaultedPosInt = DefaultValue | PosInt Int
instance Num DefaultedPosInt where
fromInteger x =
let int = fromInteger x
in if int <= 0 then DefaultValue else PosInt int
DefaultValue + _ = DefaultValue
_ + DefaultValue = DefaultValue
PosInt x + PosInt y = PosInt (x + y)
@gibiansky
gibiansky / reddit_answer
Created March 14, 2015 17:31
Limiting Type Variables to Exclude Function Types
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Banning Function Types\n",
"\n",
"See [this reddit question](http://www.reddit.com/r/haskell/comments/2z1215/limit_type_variables_to_exclude_function_types/) for the source.\n",
"\n",
@gibiansky
gibiansky / cabal install ihaskell --dependencies-only --dry-run
Created May 20, 2014 03:05
cabal issues with --reorder-goals (all with -v3)
Using a sandbox located at /Users/silver/test4/.cabal-sandbox
Searching for ghc in path.
Found ghc at /Users/silver/dev/homebrew/bin/ghc
("/Users/silver/dev/homebrew/bin/ghc",["--numeric-version"])
/Users/silver/dev/homebrew/bin/ghc is version 7.6.3
looking for tool ghc-pkg near compiler in /Users/silver/dev/homebrew/bin
found ghc-pkg in /Users/silver/dev/homebrew/bin/ghc-pkg
("/Users/silver/dev/homebrew/bin/ghc-pkg",["--version"])
/Users/silver/dev/homebrew/bin/ghc-pkg is version 7.6.3
("/Users/silver/dev/homebrew/bin/ghc",["--supported-languages"])
@gibiansky
gibiansky / cabal output2
Created May 20, 2014 02:56
cabal output2
Using a sandbox located at /Users/silver/test3/.cabal-sandbox
Searching for ghc in path.
Found ghc at /Users/silver/dev/homebrew/bin/ghc
("/Users/silver/dev/homebrew/bin/ghc",["--numeric-version"])
/Users/silver/dev/homebrew/bin/ghc is version 7.6.3
looking for tool ghc-pkg near compiler in /Users/silver/dev/homebrew/bin
found ghc-pkg in /Users/silver/dev/homebrew/bin/ghc-pkg
("/Users/silver/dev/homebrew/bin/ghc-pkg",["--version"])
/Users/silver/dev/homebrew/bin/ghc-pkg is version 7.6.3
("/Users/silver/dev/homebrew/bin/ghc",["--supported-languages"])
@gibiansky
gibiansky / cabal output
Created May 20, 2014 02:40
cabal output
Using a sandbox located at /Users/silver/test2/.cabal-sandbox
Searching for ghc in path.
Found ghc at /Users/silver/dev/homebrew/bin/ghc
("/Users/silver/dev/homebrew/bin/ghc",["--numeric-version"])
/Users/silver/dev/homebrew/bin/ghc is version 7.6.3
looking for tool ghc-pkg near compiler in /Users/silver/dev/homebrew/bin
found ghc-pkg in /Users/silver/dev/homebrew/bin/ghc-pkg
("/Users/silver/dev/homebrew/bin/ghc-pkg",["--version"])
/Users/silver/dev/homebrew/bin/ghc-pkg is version 7.6.3
("/Users/silver/dev/homebrew/bin/ghc",["--supported-languages"])
@gibiansky
gibiansky / .ycm_extra_conf.py
Created May 2, 2014 17:32
My .ycm_extra_conf.py
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
[10455] [!!!] 15:01:48 silver@vortex /pr/tmp/julia-BM6O (master...) ⇒ BUILD_OPTS="prefix=/usr/local/Cellar/julia/HEAD USE_BLAS64=0 USECLANG=1 LIBBLAS=-lopenblas LIBBLASNAME=libopenblas LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas USE_SYSTEM_ZLIB=1 USE_SYSTEM_FFTW=1 USE_SYSTEM_READLINE=1 USE_SYSTEM_GLPK=1 USE_SYSTEM_GMP=1 USE_SYSTEM_LLVM=1 USE_SYSTEM_PCRE=1 USE_SYSTEM_BLAS=1 USE_SYSTEM_SUITESPARSE=1 USE_SYSTEM_ARPACK=1 USE_SYSTEM_MPFR=1 USE_SYSTEM_LAPACK=1"
[10455] [!!!] 15:01:56 silver@vortex /pr/tmp/julia-BM6O (master...) ⇒ make -C contrib -f repackage_system_suitesparse4.make $BUILD_OPTS
mkdir -p /private/tmp/julia-BM6O/usr/lib
mkdir -p /private/tmp/julia-BM6O/deps/SuiteSparse-SYSTEM/lib
cd /private/tmp/julia-BM6O/deps/SuiteSparse-SYSTEM/lib && \
rm -f /private/tmp/julia-BM6O/usr/lib/lib{amd,cholmod,colamd,spqr,umfpack}.dylib && \
clang -stdlib=libc++ -mmacosx-version-min=10.7 -shared -Xlinker -all_load /Users/silver/dev/homebrew/opt/suite-sparse-julia/lib/libamd.a -o /private/tmp/julia-BM6O/u
@gibiansky
gibiansky / 01.make
Created February 14, 2014 22:12
julia homewbrew install logs
mkdir -p /private/tmp/julia-LRyS/usr/lib
mkdir -p /private/tmp/julia-LRyS/deps/SuiteSparse-SYSTEM/lib
cd /private/tmp/julia-LRyS/deps/SuiteSparse-SYSTEM/lib && \
rm -f /private/tmp/julia-LRyS/usr/lib/lib{amd,cholmod,colamd,spqr,umfpack}.dylib && \
clang -stdlib=libc++ -mmacosx-version-min=10.7 -shared -Xlinker -all_load /Users/silver/dev/homebrew/opt/suite-sparse-julia/lib/libamd.a -o /private/tmp/julia-LRyS/usr/lib/libamd.dylib && \
install_name_tool -id @rpath/libamd.dylib /private/tmp/julia-LRyS/usr/lib/libamd.dylib && \
clang -stdlib=libc++ -mmacosx-version-min=10.7 -shared -Xlinker -all_load /Users/silver/dev/homebrew/opt/suite-sparse-julia/lib/libcolamd.a -o /private/tmp/julia-LRyS/usr/lib/libcolamd.dylib && \
install_name_tool -id @rpath/libcolamd.dylib /private/tmp/julia-LRyS/usr/lib/libcolamd.dylib && \
clang++ -stdlib=libc++ -mmacosx-version-min=10.7 -shared -Xlinker -all_load /Users/silver/dev/homebrew/opt/suite-sparse-julia/lib/libsuitesparseconfig.a /Users/silver/dev/homebrew/opt/suite-s
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane...
100 134 100 134 0 0 295 0 --:--:-- --:--:-- --:--:-- 295