From a1d8187431d9b26110665a3621bdaa7d09b2ad25 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Sun, 5 Jan 2020 10:29:46 +0100 Subject: [PATCH] added shell.nix moved focus point --- .gitignore | 3 +++ asciimandel.hs | 2 +- shell.nix | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8e233f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +*.hi +asciimandel diff --git a/asciimandel.hs b/asciimandel.hs index 523fa2e..b079ac0 100644 --- a/asciimandel.hs +++ b/asciimandel.hs @@ -1,7 +1,7 @@ {-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} type C=(Double,Double) instance Num C where (x,y)*(z,t)=(z*x-y*t,y*z+x*t);(x,y)+(z,t)=(x+z,y+t);abs((x,y))=(sqrt(x*x+y*y),0.0) -a=27;b=79;c=(-2.0,-1.0);d=(1.0,1.0);e=(-1.064,-0.15);r((x,y))=x;i((x,y))=y +a=27;b=79;c=(-2.0,-1.0);d=(1.0,1.0);e=(-2.791,-1.0000);r((x,y))=x;i((x,y))=y f::C->C->Int->Int f c z 0=0;f c z n=if(r(abs(z))>2)then n else f c ((z*z)+c) (n-1) h j k = map(\z->(f (z) (0,0) 32,(fst z>l - q/2)))[(x,y)|y<-[p,(p+((o-p)/a))..o],x<-[m,(m + q)..l]]where o=i k;p=i j;m=r j;l=r k;q=(l-m)/b; diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9918136 --- /dev/null +++ b/shell.nix @@ -0,0 +1,26 @@ + { nixpkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz) {} }: + let + inherit (nixpkgs) pkgs; + inherit (pkgs) haskellPackages; + + haskellDeps = ps: with ps; [ + base + protolude + containers + ]; + + ghc = haskellPackages.ghcWithPackages haskellDeps; + + nixPackages = [ + ghc + pkgs.gdb + haskellPackages.cabal-install + ]; + in + pkgs.stdenv.mkDerivation { + name = "env"; + buildInputs = nixPackages; + shellHook = '' + export PS1="\n[hs:\033[1;32m\]\W\[\033[0m\]]> " + ''; + }