Slide 1

Slide 1 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer Arnaud Bailly - Willem van den Ende [email protected] - [email protected] http://www.capital-match.com @abailly - @mostalive 1 Haskell All the Way Down Continuous deployment in an early stage startup

Slide 2

Slide 2 text

/dev/summer 2015 #devsummer Agenda ▪ Who/Why/What ▪ How we use Haskell ▪ The Good, the Bad and the Ugly ▪ Future work This is not a Monad tutorial…. 2

Slide 3

Slide 3 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer Who? What? Why? 3

Slide 4

Slide 4 text

/dev/summer 2015 #devsummer What? Marketplace Lending! ~S$32,400 repayment in 1 year Bank P2P lending Bank n lenders n deposits = S$30,000
 @ 1.5% interest rate SME(borrower) S$30,000 loan @ 8% ~S$30,450 repayment in 1 year Return of 6.5% or S$1,950 ~S30,500 or 1.5% RETURN 4 Capital Match Lender 1 Lender 2 Lender 3 SME(borrower) Loan syndication on behalf of the lenders S$30,000 loan @ 6.3% 1%+ underwriting fee = S $300-400 S$5,000 loan @ 7% S$5,000 loan @ 7% S$20,000 loan @ 6% ~S$31,900 repayment in 1 year ~S$31,500 repayment 20% commission on returns = S$400 ~S20,960 or 4.8% ~S$5,280 or 5.6% ~S$5,280 or 5.6% 1% provisional fund = S$300 Provis. Fund

Slide 5

Slide 5 text

/dev/summer 2015 #devsummer Why did we start with Haskell? ▪ Pawel had very good experience working with Haskell developers at previous job ▪ He posted job offer on http://functionaljobs.com ▪ I wanted to do some real stuff in Haskell ▪ I had good experience working for people in Singapore ▪ It seemed fun! Let’s do it! 5

Slide 6

Slide 6 text

/dev/summer 2015 #devsummer System Overview 6

Slide 7

Slide 7 text

/dev/summer 2015 #devsummer Application Architecture 7

Slide 8

Slide 8 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer How we use Haskell? 8

Slide 9

Slide 9 text

/dev/summer 2015 #devsummer For (Nearly) Everything! ▪ Dev. Env ⟶ ghc-mod, stylish-haskell ▪ Web Backend ⟶ Scotty, Blaze ▪ Database ⟶ Custom Event Sourcing ▪ Unit/Integration Testing ⟶ HSpec, QuickCheck ▪ End-to-End Testing ⟶ hs-webdriver ▪ Build ⟶ Cabal, Shake ▪ CI Server ⟶ Bake ▪ Configuration Management ⟶ Propellor 9

Slide 10

Slide 10 text

/dev/summer 2015 #devsummer For the rest… ▪ Web Front-end ⟶ Om/Clojurescript ▪ Version Control ⟶ Git (what else?) ▪ Packaging & Deployment ⟶ Docker (because we can) ▪ Infrastructure ⟶ DigitalOcean / S3 ▪ Monitoring ⟶ Riemann, collectd (WIP) 10

Slide 11

Slide 11 text

/dev/summer 2015 #devsummer HSpec: Integration Tests 11

Slide 12

Slide 12 text

/dev/summer 2015 #devsummer hs-webdriver: ETE Testing 12

Slide 13

Slide 13 text

/dev/summer 2015 #devsummer Shake: Better make 13

Slide 14

Slide 14 text

/dev/summer 2015 #devsummer Bake: CI 14

Slide 15

Slide 15 text

/dev/summer 2015 #devsummer Propellor: Config Mgt. 15

Slide 16

Slide 16 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer The Good, the Bad and the Ugly 16

Slide 17

Slide 17 text

/dev/summer 2015 #devsummer The Good ▪ Safer programming (shines in comparison with front-end dev) thanks to typing and compilation ▪ Types really help a lot: Documentation, intention, design, checking… ▪ Libraries and tools are most often good or very good even when in “beta" or “alpha" (e.g. bake) ▪ Nice and supportive maintainers and community ▪ We feel productive and confident to ship haskell code: Static Typing + Tests Rock! 17

Slide 18

Slide 18 text

/dev/summer 2015 #devsummer The Good (contd.) ▪ Refactoring is easier: Change a type and fix compiler’s errors ▪ Good for hiring: Haskell attracts “interesting" people ▪ Very easy to replace clunky scripts with typesafe and compiled DSL 18

Slide 19

Slide 19 text

/dev/summer 2015 #devsummer The Bad ▪ Cabal – but does its job, no binary packages possible and there is Shake for funky stuff – it is improving (e.g. Stackage, Stack) ▪ Dev. Env. is still not on par with Eclipse/IntelliJ/VS – but FPComplete and others are making progress fast and tooling improves continuously ▪ Compilation typing errors – but you get accustomed to it once your code base is stable 19

Slide 20

Slide 20 text

/dev/summer 2015 #devsummer The Bad (contd.) ▪ Hiring: Hard to do if you require local people, Haskell communities are usually small. – but you can work remotely ▪ Can get pretty abstract pretty quickly… – pair programming and peer reviews to the rescue! ▪ Reinventing the wheel… – but that’s fun! 20

Slide 21

Slide 21 text

/dev/summer 2015 #devsummer The Ugly ▪ String vs. Data.Text vs. Data.Text.Lazy vs. – ⟶ Oh My! Haskell is Old! ▪ Runtime error reporting – ⟶ No Stack Traces! ▪ Aeson deserialization errors – ⟶ Cryptic No Parse ▪ Conflicting GHC versions/Libs requirements – ⟶ Cabal Hell, enter Stack! ▪ Laziness can bite you 21

Slide 22

Slide 22 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer Conclusion Haskell really pays off when you embrace it fully 22

Slide 23

Slide 23 text

Haskell SG - 2015-05-06 BreizhCamp 2015 #BzhCmp /dev/summer 2015 #devsummer Questions? 23