This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Debug.Trace as DEBUG | |
import GHC.Stack | |
myTraceStack :: (HasCallStack) => String -> a -> a | |
myTraceStack msg = DEBUG.trace (msg <> "\n" <> prettyCallStack callStack) | |
-- We could define 'myTraceStackM' in terms of 'myTraceStack' but that would | |
-- include 'myTraceStackM' in the call stack. We could freeze the call stack, | |
-- but it's fairly simple to just redefine it instead. | |
myTraceStackM :: (Applicative m, HasCallStack) => String -> m () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A concrete use case for the type which is to '(->)' as 'Day' is to '(,)'. | |
-- I call it "FunDay", but I don't know what its proper name is. I've been | |
-- trying to find a use for 'FunDay', and I think I've found a pretty neat one. | |
{-# LANGUAGE FlexibleContexts, FlexibleInstances, PolyKinds, RankNTypes, TypeSynonymInstances #-} | |
module Main where | |
import Test.DocTest | |
import Control.Monad.Except | |
import Control.Monad.Reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE StrictData #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE NumericUnderscores #-} | |
module Main where | |
import Control.Monad | |
import Database.EventStore | |
import qualified Data.Text as Text | |
import Data.Aeson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
template <template <class, class...> class f> | |
struct functor { | |
template<typename a, typename b> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-| This @lens@ tutorial targets Haskell beginners and assumes only basic | |
familiarity with Haskell. By the end of this tutorial you should: | |
* understand what problems the @lens@ library solves, | |
* know when it is appropriate to use the @lens@ library, | |
* be proficient in the most common @lens@ idioms, | |
* understand the drawbacks of using lenses, and: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DefaultSignatures #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
import Control.Monad.Trans.Class | |
import qualified Control.Monad.Trans.State as State | |
import Control.Monad.Trans.Identity (IdentityT) | |
import Control.Monad.Trans.Reader (ReaderT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set directory=~/.vim/backup | |
set backupdir=~/.vim/backup " keep swap files here | |
filetype off " required | |
call plug#begin('~/.local/share/nvim/plugged') " you need to create this directory first (or change it) | |
Plug 'vim-airline/vim-airline' " bottom status bar | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy finder conf | |
Plug 'junegunn/fzf.vim' " fuzzy finder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is an approach to refine ability to selectively override | |
-- instances when deriving using deriving via method. Idea was first | |
-- presented here: | |
-- | |
-- http://caryrobbins.com/dev/overriding-type-class-instances/ | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DerivingVia #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# language TypeInType #-} | |
-- | Types which have PureScript equivalents | |
class ToPursTyCon a where | |
toPursTyCon :: Tagged a PursTypeConstructor | |
-- | The default instance uses 'G.Generic' and pattern matches on the | |
-- type's representation to create a PureScript type. | |
default toPursTyCon :: (G.Generic a, GenericToPursTyCon (G.Rep a)) => Tagged a PursTypeConstructor | |
toPursTyCon = retag $ genericToPursTyConWith @(G.Rep a) defaultPursTypeOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project=$(basename "$(pwd)") | |
# build dependencies | |
build_deps="stack build $project --fast --pedantic --dependencies-only --interleaved-output" | |
# restart on changes in other packages | |
restarts=$(find ../. -maxdepth 1 -type d \ | |
-not -name "$project" \ | |
-not -name .stack-work \ | |
-not -name . \ |