pursuing the strong, not so silent type: a haskell story

Download Pursuing the Strong, Not So Silent Type: A Haskell Story

If you can't read please download the document

Post on 10-Feb-2017

652 views

Category:

Software

0 download

Embed Size (px)

TRANSCRIPT

  • Pursuing the strong, not so silent type

    A Haskell story

    by Katie Miller (@codemiller) Software Engineer at Facebook

  • "The limits of my language mean the limits of my world"

    - Ludwig Wittgenstein

  • strong static types

  • Source: Ruin Raider on Flickr, CC BY-NC-ND 2.0

    https://www.flickr.com/photos/bobex_pics/4930295683/https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode

  • more than 1 million requests/second

  • def haskell_spammer(user, friend, post) if talking_about_haskell(post) && num_common_friends(user, friend) < 5 && most_friends_like_ruby(friend) block_post else do_nothing end end

  • continuous deployment

  • FXL

  • functional

  • efficient data fetching

  • automatic batching and concurrency

  • HaskellSpammer = If (TalkingAboutHaskell(postContent) && NumCommonFriends(userId, friendId) < 5 && MostFriendsLikeRuby(friendId)) Then BlockAction Else @[]

    NumCommonFriends(x, y) = Length(Intersect(FriendsOf(x), FriendsOf(y)))

  • 20x speedup

  • Haskell

  • Is Haskell academic?

  • Source: https://xkcd.com/1312

    https://xkcd.com/1312

  • reasoning about code

  • haskellSpammer :: Haxl Bool haskellSpammer = talkingAboutHaskell .&& numCommonFriends .< 5 .&& mostFriendsLikeRuby

    where mostFriendsLikeRuby = do friends

  • user-defined data types

  • hasAssoc :: Int -> Int -> Int -> Bool hasAssoc id assoc target = ...

  • hasAssoc :: Int -> Int -> Int -> Bool hasAssoc id assoc target = ...

    newtype Id = Id Int newtype AssocId = AssocId Int

  • hasAssoc :: Int -> Int -> Int -> Bool hasAssoc id assoc target = ...

    newtype Id = Id Int newtype AssocId = AssocId Int

    hasAssoc :: Id -> AssocId -> Id -> Bool hasAssoc id assoc target = ...

  • data Language = Ruby | Haskell | Php

  • data Language = Ruby | Haskell | Php

    likesLanguage :: Language -> Id -> Bool

  • data Language = Ruby | Haskell | Php

    likesLanguage :: Language -> Id -> BoollikesLanguage Ruby userId = hasAssoc userId likesAssoc 1995 || hasAssoc userId likesAssoc 2005

  • data Language = Ruby | Haskell | Php

    likesLanguage :: Language -> Id -> BoollikesLanguage Ruby userId = hasAssoc userId likesAssoc 1995 || hasAssoc userId likesAssoc 2005likesLanguage Haskell userId = hasAssoc userId likesAssoc 42

  • data Language = Ruby | Haskell | Php

    likesLanguage :: Language -> Id -> BoollikesLanguage Ruby userId = hasAssoc userId likesAssoc 1995 || hasAssoc userId likesAssoc 2005likesLanguage Haskell userId = hasAssoc userId likesAssoc 42likesLanguage Php _ = False

  • Is Haskell difficult to learn?

  • expectations

  • Is Haskell a panacea?

  • blockAustralians :: Haxl SyncResponses blockAustralians = do textMap
  • blockAustralians :: Haxl SyncResponses blockAustralians = do textMap
  • results

  • ideas worth pursuing

  • community

  • Haxl team past and present

    Louis Brandy

    Jonathan Coens

    Andrew Farmer

    Kubo Kov

    Jake Lengyel

    Simon Marlow

    Katie Miller

    Bartosz Nitka

    Jon Purdy

    Aaron Roth

    Zejun Wu

    Noam Zilberstein

  • More about Haxl

    Haxl on GitHub

    'Fighting spam with Haskell' blog post

    'There is no Fork' ICFP paper and presentation

    'The Road to Running Haskell at Facebook Scale' presentation

    Wired article

    https://github.com/facebook/Haxlhttps://code.facebook.com/posts/745068642270222/fighting-spam-with-haskell/http://community.haskell.org/~simonmar/papers/haxl-icfp14.pdfhttps://www.youtube.com/watch?v=jG9PWdV1wsohttp://www.codemesh.io/codemesh2015/jon-coenshttp://www.wired.com/2015/09/facebooks-new-anti-spam-system-hints-future-coding/

  • The End

    by Katie Miller (@codemiller) Software Engineer at Facebook