Skip to content

Instantly share code, notes, and snippets.

View Tehnix's full-sized avatar
🌞
Enjoying the code...

Christian Kjær Tehnix

🌞
Enjoying the code...
View GitHub Profile
@Tehnix
Tehnix / UsingHasConfig.hs
Created November 17, 2018 23:49
Problems with type inference, `HasAwsCredentials env String` and `Member (Reader env) effs`
#!/usr/bin/env stack
-- stack --resolver lts-12.16 script --package freer-simple --package lens
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module Test where
@Tehnix
Tehnix / libHStext-icu issues.md
Last active July 21, 2018 22:51
libHStext-icu issues on macOS, usually while building HIE (or anything with yi-rope)

Problem

If you update ICU on macOS, some packages are dynamically linked against a specific version, but the older version might dissapear. You'll see this with something like,

$ stack --stack-yaml=stack-8.0.2.yaml install --extra-lib-dirs=/usr/local/opt/icu4c/lib --extra-include-dirs=/usr/local/opt/icu4c/include
...
HaRe-0.8.4.1: copy/register
brittany-0.11.0.0: copy/register
Progress 18/20
λ miso-isomorphic-stack/frontend ‹master!› stack build
attoparsec-iso8601-1.0.0.0: configure
StateVar-1.1.0.4: configure
base-orphans-0.6: configure
blaze-builder-0.4.0.2: configure
Progress: 4/37
-- While building custom Setup.hs for package blaze-builder-0.4.0.2 using:
/Users/tehnix/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghcjs-0.2.1.9009021_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0_ghcjs configure --with-ghcjs=/Users/tehnix/.stack/programs/x86_64-osx/ghcjs-0.2.1.9009021_ghc-8.0.2/bin/ghcjs --with-ghcjs-pkg=/Users/tehnix/.stack/programs/x86_64-osx/ghcjs-0.2.1.9009021_ghc-8.0.2/bin/ghcjs-pkg --user --package-db=clear --package-db=global --package-db=/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/ghcjs-0.2.1.9009021_ghc-8.0.2/pkgdb --libdir=/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/ghcjs-0.2.1.9009021_ghc-8.0.2/lib --bindir=/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/ghcjs-0.2.1.9009021_ghc-8.0.2/bin --datadir=/Users/tehnix/.stack/snaps
@Tehnix
Tehnix / getting-started-with-miso.md
Created March 8, 2018 22:04
Getting started with Miso/GHCJS

Toolchain

We have the choice of either using Nix or Stack. Stack is definitely the easiest by far, but Nix will technically be able to provide the most stable build result (assuming it works on macOS...).

To build the sample app with nix, we can do,

$ git clone https://github.com/dmjio/miso && cd miso/sample-app && nix-build

and with stack,

@Tehnix
Tehnix / getting-started-with-purescript.md
Last active July 12, 2018 21:04
Getting started with purescript

Jump straight into toying with PureScript!

Also, if you know JavaScript already, you might find this video interesting, which demonstrates the neat ability to look directly at the very readable generated JavaScript.

Toolchain

We need various tools to get started developing PureScript in a modern fashion. Let's first tackle the npm installable ones,

$ npm install -g psvm psc-package pulp
@Tehnix
Tehnix / output.log
Created January 28, 2018 12:54
Attempting `nix-build` on package that depends on `freer-simple`
$ nix-build --show-trace
error: while evaluating the attribute ‘buildCommand’ of the derivation ‘reflex-project’ at /nix/store/b4qbhg82hwx7z07mxlzscjnq4xsfglxw-source/pkgs/stdenv/generic/make-derivation.nix:129:11:
while evaluating anonymous function at /nix/store/b4qbhg82hwx7z07mxlzscjnq4xsfglxw-source/lib/attrsets.nix:224:10, called from undefined position:
while evaluating anonymous function at /Users/tehnix/GitHub/Tehnix/master-thesis/src-reflex/reflex-platform/project/default.nix:175:36, called from /nix/store/b4qbhg82hwx7z07mxlzscjnq4xsfglxw-source/lib/attrsets.nix:224:16:
while evaluating ‘optionalString’ at /nix/store/b4qbhg82hwx7z07mxlzscjnq4xsfglxw-source/lib/strings.nix:138:26, called from /Users/tehnix/GitHub/Tehnix/master-thesis/src-reflex/reflex-platform/project/default.nix:175:44:
while evaluating ‘concatMapStringsSep’ at /nix/store/b4qbhg82hwx7z07mxlzscjnq4xsfglxw-source/lib/strings.nix:64:33, called from /Users/tehnix/GitHub/Tehnix/master-thesis/src-reflex/reflex-platform/project/default.nix:
@Tehnix
Tehnix / output.log
Created January 27, 2018 17:17
Last bit of output from `./run-todomvc-in-ios-sim.sh`
checking if we must define _XOPEN_SOURCE_EXTENDED... x86_64-apple-darwin14-clang -O3 -DHAVE_HIDDEN -c -o compress.o compress.c [15/13642]
yes
checking for putwc... yes
checking for strings.h... x86_64-apple-darwin14-clang -O3 -DHAVE_HIDDEN -c -o uncompr.o uncompr.c
yes
checking for btowc... x86_64-apple-darwin14-clang -O3 -DHAVE_HIDDEN -c -o gzclose.o gzclose.c
yes
checking for inttypes.h... yes
checking for wctob... x86_64-apple-darwin14-clang -O3 -DHAVE_HIDDEN -c -o gzlib.o gzlib.c
yes
@Tehnix
Tehnix / DisableWindowsKey.ahk
Created November 21, 2017 07:41
Disable the Windows Key on Windows using Autohotkey (quite annoying in bootcamp coming from macOS). Save this file on your desktop and double click it (or in your startup folder for it to run automatically).
; Disable Alt+Tab
; !Tab::Return
; Disable Windows Key + Tab
#Tab::Return
; Disable Left Windows Key
LWin::Return
; Disable Right Windows Key
@Tehnix
Tehnix / CapsLockToEsc.ahk
Created November 21, 2017 07:40
Map Caps Lock to Esc on Windows using Autohotkey. Save this file on your desktop and double click it (or in your startup folder for it to run automatically).
Capslock::Esc
Esc::
SetCapsLockState, off
Suspend On
Send, {ESC}
Suspend Off
return
@Tehnix
Tehnix / settings.json
Created November 9, 2017 09:20
VS Code settings
{
// Common Configuration
"workbench.colorTheme": "Spacemacs",
"editor.fontFamily": "Hasklig, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 11,
"workbench.sideBar.location": "right",
"editor.minimap.enabled": false,
"workbench.startupEditor": "none",
"editor.accessibilitySupport": "off",
"explorer.openEditors.visible": 0,