Skip to content

Instantly share code, notes, and snippets.

View nkpart's full-sized avatar

Nick Partridge nkpart

  • Brisbane, Australia
View GitHub Profile
@nkpart
nkpart / that.diff
Last active September 4, 2017 02:35
diff --git a/papa-base-export/src/Papa/Base/Export.hs b/papa-base-export/src/Papa/Base/Export.hs
index 5fa74b8..ea9438d 100644
--- a/papa-base-export/src/Papa/Base/Export.hs
+++ b/papa-base-export/src/Papa/Base/Export.hs
@@ -1,29 +1,49 @@
{-# LANGUAGE NoImplicitPrelude #-}
module Papa.Base.Export(
- module P
+ module Papa.Base.Export.Control.Applicative,
10:11 dalaing I've just remembered - I have some reflex code to share for those who were interested
10:11 mankyKitty :D
10:12 dalaing there's an evolution of component design / list management through these pieces
10:12 oharvey (IRC) ith all this fancy development someone might get the idea that you work at a research lab.
10:12 dalaing we start off with components that take Dynamics as inputs and Events as outputs - that's the standard advice on where to start
10:12 dalaing so something like: https://github.com/qfpl/intro-to-reflex-compose/blob/master/code/src/Examples/Components/Pass1.hs#L88
10:14 dalaing we add a model for TodoItems: https://github.com/qfpl/intro-to-reflex-compose/blob/master/code/src/Examples/Components/Pass1.hs#L134
10:14 dalaing and then we build something that works with them: https://github.com/qfpl/intro-to-reflex-compose/blob/master/code/src/Examples/Components/Pass1.hs#L142
10:15 dalaing it takes in a Dynamic t TodoItem, and gives us two events - one Event t (TodoItem -> T
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import qualified Data.Aeson as A
import qualified Data.Foldable as F (foldMap)
import qualified Data.Geography.GeoJSON as GJ
import qualified Data.HashMap.Strict as HM
import qualified Data.Map.Lazy as DMZ
import Data.Maybe
import Data.Scientific
import qualified Data.Text as T (Text)
@nkpart
nkpart / Warpy.hs
Last active July 12, 2017 06:30
JSaddle plus static file serving
{-
Hacked Language.Javascript.JSaddle.Warp that also serves a static directory of files. a 404 on the static application
is handled by the hosted jsaddle app.
-}
{-# LANGUAGE CPP #-}
module Warpy (
12.887755 0.000000
13.365079 0.000000
13.842403 0.000000
14.319728 0.000000
14.797052 0.000000
15.274377 735.613403
15.751700 243.770004
16.229025 243.677719
16.706348 243.593506
17.183674 121.829514
//: Playground - noun: a place where people can play
import Cocoa
import Foundation
// 0. BASE CASE
// Our Error enum
enum FailsUserI {
@nkpart
nkpart / fmap.hs
Last active October 19, 2016 23:42
Prelude Control.Monad> :t map
map :: (a -> b) -> [a] -> [b]
Prelude Control.Monad> :t fmap
fmap :: Functor f => (a -> b) -> f a -> f b
Prelude Control.Monad> :t Control.Monad.liftM
Control.Monad.liftM :: Monad m => (a1 -> r) -> m a1 -> m r
Prelude Control.Monad> :t Control.Applicative.liftA
Control.Applicative.liftA
:: Applicative f => (a -> b) -> f a -> f b

nkpart: Why haskell? Super cheap upgrades. Major compiler versions, major library versions, no worries.

parqit: @nkpart can you please elaborate on "cheap"?

For sure!

At veitchlister.com.au, we use a mix of Haskell and Ruby (with a smattering of Java and C++ around as well). As you can imagine, there are stark difference when you are maintaining code across these ecosystems! We have been doing this for a few years now, such that we have code in all languages that has been around for at least a few years, and we've been through large refactors, system upgrades and dependency upgrades in each.

  1. Installing GHC
stack setup --resolver ghc-8.0.1

This is the template for all future commands:

stack --resolver ghc-8.0.1 exec --no-ghc-package-path -- ghc --version