Skip to content

Instantly share code, notes, and snippets.

View dmitriz's full-sized avatar

Dmitri Zaitsev dmitriz

View GitHub Profile
@dmitriz
dmitriz / install errors
Created August 27, 2019 09:31
stack install package
```sh
➜ ~ stack install sized
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for sized-0.3.0.0:
equational-reasoning must match >=0.5, but the stack configuration has no specified version (latest matching
version is 0.6.0.0)
ghc-typelits-presburger must match >=0.2.0.0, but the stack configuration has no specified version (latest
matching version is 0.2.0.5)
@dmitriz
dmitriz / stack struggles
Created August 22, 2019 02:35
haskell stack
With no local config present, `stack` is picking the old ghc 8.2.2:
```sh
➜ test stack ghci
Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.
You are using snapshot: lts-11.9
If you want to use package hiding and options, then you can try one of the following:
@dmitriz
dmitriz / fmap
Created August 17, 2019 02:55
ghci errors
λ [9]: fmap f [1]
Out [9]:
<interactive>:186:1: error:
• Ambiguous type variable ‘f0’ arising from a use of ‘print’
prevents the constraint ‘(Show (f0 Integer))’ from being solved.
Probable fix: use a type annotation to specify what ‘f0’ should be.
These potential instances exist:
instance Show a => Show (ZipList a)
-- Defined in ‘Control.Applicative’
@dmitriz
dmitriz / build
Created August 15, 2019 14:12
Installing ptghci
Trying to install
https://github.com/litxio/ptghci
✗ cabal v2-build
Build profile: -w ghc-8.0.1 -O1
In order, the following will be built (use -v for more details):
- ptghci-0.1.0.0 (lib) (first run)
- ptghci-0.1.0.0 (exe:ptghci) (first run)
Preprocessing library for ptghci-0.1.0.0..
Building library for ptghci-0.1.0.0..
@dmitriz
dmitriz / cabal
Created August 15, 2019 08:24
Cabal errors
✗ cabal v2-build
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: ptghci (user goal)
[__0] rejecting: ptghci-0.1.0.0 (conflict: pkg-config package python3-any, not
found in the pkg-config database)
[__0] fail (backjumping, conflict set: ptghci)
After searching the rest of the dependency tree exhaustively, these were the
@dmitriz
dmitriz / ghcup
Created August 15, 2019 05:43
Haskell errors
✗ ghcup install
Installing GHC-8.6.5 for Darwin on architecture x86_64
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
Failed to create temporary directory
@dmitriz
dmitriz / style_guide.md
Created April 19, 2018 16:39 — forked from dominictarr/style_guide.md
style guide

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@dmitriz
dmitriz / myRSI.js
Created January 10, 2018 04:55 — forked from howie50417/myRSI.js
myRSI.js
var _ = require('lodash');
var log = require('../core/log.js');
var RSI = require('./indicators/RSI.js');
// let's create our own method
var method = {};
// prepare everything our method needs
method.init = function() {
@dmitriz
dmitriz / gist:4d5f0ffcad33a75f3a534df3a330eb30
Last active May 28, 2019 04:04
Array functor uglified

Let us make the array functor slightly uglier.

According to Functor's definition, for every type a, we first need to define the type F(a), the set of all admissible values for our Functor.

For the array Functor Array, that would be the set [a] of all arrays with entries of type a.

We now define a new Functor F, where we slightly change the set of values F(a): Namely, we say that an array arr is of type F(a) if either

@dmitriz
dmitriz / db-alt.js
Created May 13, 2017 06:47 — forked from i-am-tom/db-alt.js
Database failover modelled with the `alt` typeclass.
const Task = require('data.task')
Task.prototype.alt = function (that) {
return new Task((rej, res) =>
this.fork(_ => that.fork(rej, res), res))
}
const hosts = [
[ 'db1.mysite.com', 'user', 'password' ],
[ 'db2.mysite.com', 'user', 'password' ],