Skip to content

Instantly share code, notes, and snippets.

Dmitri Zaitsev dmitriz

Block or report user

Report or block dmitriz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dmitriz
dmitriz / install errors
Created Aug 27, 2019
stack install package
View install errors
```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)
View stack struggles
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 Aug 17, 2019
ghci errors
View fmap
λ [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 Aug 15, 2019
Installing ptghci
View build
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 Aug 15, 2019
Cabal errors
View cabal
✗ 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 Aug 15, 2019
Haskell errors
View ghcup
✗ 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
View style_guide.md

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 Jan 10, 2018 — forked from howie50417/myRSI.js
myRSI.js
View 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() {
View gist:4d5f0ffcad33a75f3a534df3a330eb30

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 — forked from i-am-tom/db-alt.js
Database failover modelled with the `alt` typeclass.
View db-alt.js
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' ],
You can’t perform that action at this time.