What does new Array(x) do? Trick question. It does different things depending on whether x is an integer or something else.
I wanted to replicate this elegant functionality in Haskell: behold.
| {-# LANGUAGE KindSignatures, DataKinds, FlexibleInstances, FlexibleContexts, | |
| FunctionalDependencies, TypeFamilies, TypeOperators, | |
| PatternSynonyms, UndecidableInstances, ConstraintKinds, | |
| TypeApplications, ScopedTypeVariables, CPP #-} | |
| module NamedDefaults (FillDefaults, fillDefaults, (!.)) where | |
| import Prelude (Maybe(..), id) | |
| import Data.Kind (Type) |
I've been working quite extensively with Wizek during last several days. In few words: I am very motivated by my experience and I hope that there will be a community for pair-programming. My intuition is that you exchange your time for the ability to stay focused and motivated.
Below is more structured feedback.
Open questions: I was working with a haskeller who is more experienced than me and I was working on a completely new project. I think that there are different possible setups which will lead to a different experience:
Positive feedback:
| :set prompt "> " | |
| :set -isrc | |
| :load Main |
| let | |
| hpack2nix = | |
| name: src: | |
| let | |
| addCabalFile = stdenv.mkDerivation { | |
| inherit name src; | |
| phases = [ "unpackPhase" "patchPhase" "installPhase" ]; | |
| installPhase = ''cp -r . $out''; | |
| patchPhase = '' | |
| ${haskellPackages.hpack}/bin/hpack |
| #!/bin/usr/env bash | |
| # Originaly from: https://www.reddit.com/r/NixOS/comments/5yxt45/simple_nix_package_search/ | |
| nq () { | |
| local CACHE="$HOME/.cache/nq-cache" | |
| if ! ( [ -e $CACHE ] && [ $(stat -c %Y $CACHE) -gt $(( $(date +%s) - 3600*24*7 )) ] ); then | |
| # read gotcha.. can't pipe to read (as usual zsh beats bash) | |
| read x MEM_AVAIL_KB UNIT < <(grep MemAvailable: /proc/meminfo) | |
| if [[ $UNIT != "kB" || $MEM_AVAIL_KB -lt 1000000 ]]; then | |
| # nix-env can easily use up to 1GB during -qa |
| sublime3 and ghcid setup for quick haskell coding feedback | |
| tested on sublime 3 | |
| (you can omit the SublimeOnSaveBuild steps, as the result is not | |
| completely reliable anyways. i still find it useful, though.) | |
| steps: | |
| - install https://github.com/lspitzner/SublimeOnSaveBuild | |
| (original from alexnj; in his/her version the build-window gets closed |
| #!/usr/bin/env bash | |
| # | |
| # Backup selected directories to a Backblaze B2 bucket | |
| # | |
| # Example daily cron: | |
| # @daily /usr/local/bin/b2backup >/dev/null | |
| # | |
| # Account creds | |
| id=xxxxxxxxxx |
Want to use Nix for development but you're not sure how? Concerned about the
fluidity of nixpkgs channels or not being able to easily install arbitrary
package versions?
When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.
| function c () { | |
| console.log.apply(console, arguments) | |
| return arguments[arguments.length-1] | |
| } | |
| var unboundSlice = Array.prototype.slice | |
| var slice = Function.prototype.call.bind(unboundSlice) |