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
use std::collections::hash_map::Entry; | |
use std::collections::HashMap; | |
use std::hash::Hash; | |
use std::ops::Fn; | |
struct Cacher<'a, T, A, B> | |
where | |
T: 'a + Fn(&A) -> B, | |
A: 'a, | |
B: 'a, |
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 DeriveAnyClass, DeriveDataTypeable, DeriveGeneric #-} | |
{-# LANGUAGE DerivingStrategies, FlexibleInstances, MultiWayIf #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Cell where | |
import Control.Applicative (empty) | |
import Data.Typeable (Typeable) | |
import Data.Word | |
import Ersatz | |
import GHC.Generics (Generic) |
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 DeriveAnyClass, DeriveDataTypeable, DeriveGeneric #-} | |
{-# LANGUAGE DerivingStrategies, FlexibleInstances, MultiWayIf #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Cell where | |
import Control.Applicative (empty) | |
import Data.Typeable (Typeable) | |
import Data.Word | |
import Ersatz | |
import GHC.Generics (Generic) |
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 ConstraintKinds, DataKinds, DeriveGeneric, DerivingVia #-} | |
{-# LANGUAGE ExplicitNamespaces, FlexibleContexts, FlexibleInstances #-} | |
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses #-} | |
{-# LANGUAGE PolyKinds, ScopedTypeVariables, StandaloneDeriving #-} | |
{-# LANGUAGE TypeApplications, TypeFamilies, TypeInType, TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Data.Aeson.Generic.DerivingVia | |
( StrFun(..), Setting(..), SumEncoding'(..), DefaultOptions, WithOptions(..) | |
, -- Utility type synonyms to save ticks (') before promoted data constructors |
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
these derivations will be built: | |
/nix/store/1kg1v5vy0drxyxq66dvvdwkn1304ifh9-qtwebkit-5.9.1.drv | |
/nix/store/ffja7pc88r4wyfk98pi9nk3yha9adblr-qtwebengine-5.10.1.drv | |
/nix/store/bzzbb1hrm0dz3rvndyi3mbbxqvyv3mai-python3.6-PyQt-5.10.drv | |
/nix/store/k8hyi5ys04x3zhskk7hm9sllxxbj4hmh-python3.6-qtconsole-4.3.1.drv | |
/nix/store/nba4gy75da88hd93gvlq4klq3chjya5m-python3.6-jupyter-1.0.0.drv | |
/nix/store/asds576kwc2x8zqprh598dvivhnna73b-python3-3.6.5-env.drv | |
/nix/store/jspp9rcrxh280wnb3l80f820n9hy94bf-ihaskell-console.drv | |
/nix/store/vas9ys522v10834ysxjb2pzxg4lzacdk-ihaskell-nbconvert.drv | |
/nix/store/w6hs5ji7dy7j82cw1rh2583ndpn3rgv0-ihaskell-notebook.drv |
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
#!/usr/bin/env bash | |
osascript $HOME/usr/share/toggle-tap-to-click.scpt false | |
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 ConstraintKinds, DefaultSignatures, FlexibleContexts #-} | |
{-# LANGUAGE MonoLocalBinds, MultiParamTypeClasses #-} | |
{-# LANGUAGE NoMonomorphismRestriction, ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications, UndecidableSuperClasses #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module FreeMonoid where | |
import Data.Constraint | |
import Data.Constraint.Forall | |
import Data.Monoid | |
import Data.Proxy |
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
% Naive (unbalanced) binary heap | |
module IntMap : sig | |
type 'a intmap | |
val singleton : int -> 'a -> 'a intmap | |
val empty : 'a intmap | |
val insert : int -> 'a -> 'a intmap -> 'a intmap | |
val lookup : int -> 'a intmap -> 'a option | |
end = struct |
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
let hook = line-break false false (get-standard-context 0pt) | |
(hook-page-break (fun pbInfo _ -> ( | |
numpages <- pbInfo#page-number | |
))) | |
in | |
let answer = page-break page pagecontf pagepartsf (bb-title +++ bb-toc +++ bb-main +++ hook) | |
in let () = register-cross-reference `pagecount` (arabic (!numpages)) | |
in answer |
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
locate_bin() { | |
if [ -n "$1" ]; then | |
list=$(type -ap "${1}") | |
if [ $? -eq 0 ]; then | |
echo "${list}" | head -n1 | awk -F"^${1} is " '{ print $NF }' | |
else | |
echo "No binary found: ${1}" 1>&2; return 1; | |
fi | |
else | |
echo "Please specify binary name" 1>&2; return 1; |