SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
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
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
reasoning about code
haskellSpammer	
  ::	
  Haxl	
  Bool	
  
haskellSpammer	
  =	
  	
  
	
  	
  talkingAboutHaskell	
  .&&	
  
	
  	
  numCommonFriends	
  .<	
  5	
  .&&	
  
	
  	
  mostFriendsLikeRuby	
  
	
  	
  where	
  
	
  	
  mostFriendsLikeRuby	
  =	
  do	
  
	
  	
  	
  	
  friends	
  <-­‐	
  getFriends	
  
	
  	
  	
  	
  rubyFriends	
  <-­‐	
  filterM	
  friendLikesRuby	
  friends	
  
	
  	
  	
  	
  return	
  (length	
  rubyFriends	
  >=	
  
	
  	
  	
  	
  	
  	
  length	
  friends	
  `div`	
  2)	
  
	
  	
  friendLikesRuby	
  friend	
  =	
  
	
  	
  	
  	
  hasAssoc	
  friend	
  likeAssoc	
  rubyPage
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	
  -­‐>	
  Bool
likesLanguage	
  Ruby	
  userId	
  =	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  1995	
  ||	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  2005
data	
  Language	
  =	
  Ruby	
  |	
  Haskell	
  |	
  Php
likesLanguage	
  ::	
  Language	
  -­‐>	
  Id	
  -­‐>	
  Bool
likesLanguage	
  Ruby	
  userId	
  =	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  1995	
  ||	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  2005
likesLanguage	
  Haskell	
  userId	
  =	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  42
data	
  Language	
  =	
  Ruby	
  |	
  Haskell	
  |	
  Php
likesLanguage	
  ::	
  Language	
  -­‐>	
  Id	
  -­‐>	
  Bool
likesLanguage	
  Ruby	
  userId	
  =	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  1995	
  ||	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  2005
likesLanguage	
  Haskell	
  userId	
  =	
  
	
  	
  hasAssoc	
  userId	
  likesAssoc	
  42
likesLanguage	
  Php	
  _	
  =	
  
	
  	
  False
Is Haskell difficult to learn?
expectations
Is Haskell a panacea?
blockAustralians	
  ::	
  Haxl	
  SyncResponses	
  
blockAustralians	
  =	
  do	
  
	
  	
  textMap	
  <-­‐	
  textArr	
  
	
  	
  let	
  text	
  =	
  HashMap.lookupDefault	
  ""	
  "main_text"	
  textMap	
  
	
  	
  	
  	
  	
  	
  numBadWords	
  	
  	
  =	
  length	
  $	
  filter	
  (`Text.isInfixOf`	
  text)	
  aussieTerms	
  
	
  	
  	
  	
  	
  	
  numBadPhrases	
  =	
  length	
  $	
  filter	
  (`Text.isInfixOf`	
  text)	
  aussieSayings	
  
	
  	
  if	
  numBadWords	
  <	
  2	
  &&	
  numBadPhrases	
  <=	
  0	
  
	
  	
  then	
  return	
  noResponses	
  
	
  	
  else	
  
	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  4	
  &&	
  numBadPhrases	
  <	
  2	
  
	
  	
  	
  	
  	
  	
  then	
  return	
  requireCaptcha	
  
	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  5	
  &&	
  numBadPhrases	
  <	
  3	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  [warnUser,	
  requireCaptcha]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  7	
  &&	
  numBadPhrases	
  <	
  4	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  warnUser	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  8	
  &&	
  numBadPhrases	
  <	
  5	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  [warnUser,	
  blockAccess]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  10	
  &&	
  numBadPhrases	
  <	
  6	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  13	
  &&	
  numBadPhrases	
  <	
  7	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  enrollInFakeAccountCheckpoint	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  return	
  $	
  responses	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  enrollInFakeAccountCheckpoint	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  requireCaptcha	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  where	
  
	
  	
  	
  	
  	
  	
  aussieTerms	
  =	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  "Acca	
  Dacca"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "ambo"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "arvo"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "Aussie"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "bangaroo"
blockAustralians	
  ::	
  Haxl	
  SyncResponses	
  
blockAustralians	
  =	
  do	
  
	
  	
  textMap	
  <-­‐	
  textArr	
  
	
  	
  let	
  text	
  =	
  HashMap.lookupDefault	
  ""	
  "main_text"	
  textMap	
  
	
  	
  	
  	
  	
  	
  numBadWords	
  	
  	
  =	
  length	
  $	
  filter	
  (`Text.isInfixOf`	
  text)	
  aussieTerms	
  
	
  	
  	
  	
  	
  	
  numBadPhrases	
  =	
  length	
  $	
  filter	
  (`Text.isInfixOf`	
  text)	
  aussieSayings	
  
	
  	
  if	
  numBadWords	
  <	
  2	
  &&	
  numBadPhrases	
  <=	
  0	
  
	
  	
  then	
  return	
  noResponses	
  
	
  	
  else	
  
	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  4	
  &&	
  numBadPhrases	
  <	
  2	
  
	
  	
  	
  	
  	
  	
  then	
  return	
  requireCaptcha	
  
	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  5	
  &&	
  numBadPhrases	
  <	
  3	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  [warnUser,	
  requireCaptcha]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  7	
  &&	
  numBadPhrases	
  <	
  4	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  warnUser	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  8	
  &&	
  numBadPhrases	
  <	
  5	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  [warnUser,	
  blockAccess]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  10	
  &&	
  numBadPhrases	
  <	
  6	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  numBadWords	
  <	
  13	
  &&	
  numBadPhrases	
  <	
  7	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  then	
  return	
  $	
  responses	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  enrollInFakeAccountCheckpoint	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  return	
  $	
  responses	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  blockAccess	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  enrollInFakeAccountCheckpoint	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  requireCaptcha	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  where	
  
	
  	
  	
  	
  	
  	
  aussieTerms	
  =	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [	
  "Acca	
  Dacca"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "ambo"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "arvo"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "Aussie"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  "bangaroo"
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
The End
by Katie Miller (@codemiller)
Software Engineer at Facebook

Contenu connexe

Tendances

Jonathan Worthington – Perl 2010 Rit Rakudo
Jonathan Worthington – Perl 2010 Rit RakudoJonathan Worthington – Perl 2010 Rit Rakudo
Jonathan Worthington – Perl 2010 Rit Rakudo
rit2010
 
Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
PrinceGuru MS
 
Profiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applicationsProfiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applications
Jano Suchal
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3
Fabien Potencier
 
Tulsa techfest2010 security
Tulsa techfest2010   securityTulsa techfest2010   security
Tulsa techfest2010 security
Jason Ragsdale
 

Tendances (19)

Spock
SpockSpock
Spock
 
Jonathan Worthington – Perl 2010 Rit Rakudo
Jonathan Worthington – Perl 2010 Rit RakudoJonathan Worthington – Perl 2010 Rit Rakudo
Jonathan Worthington – Perl 2010 Rit Rakudo
 
DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks
 
Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
 
Perl object ?
Perl object ?Perl object ?
Perl object ?
 
Profiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applicationsProfiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applications
 
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
 
神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)
 
Modern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlModern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in Perl
 
Cache is King - RailsConf 2019
Cache is King - RailsConf 2019Cache is King - RailsConf 2019
Cache is King - RailsConf 2019
 
What's New in the PHP Driver
What's New in the PHP DriverWhat's New in the PHP Driver
What's New in the PHP Driver
 
An (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonAn (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to Python
 
What Is Security
What Is SecurityWhat Is Security
What Is Security
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
 
mod_rewrite
mod_rewritemod_rewrite
mod_rewrite
 
Password Security
Password SecurityPassword Security
Password Security
 
How to get rid of terraform plan diffs
How to get rid of terraform plan diffsHow to get rid of terraform plan diffs
How to get rid of terraform plan diffs
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3
 
Tulsa techfest2010 security
Tulsa techfest2010   securityTulsa techfest2010   security
Tulsa techfest2010 security
 

En vedette

High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
Johan Tibell
 
Designing Online Engagement to Collaborate with Your Community
Designing Online Engagement to Collaborate with Your CommunityDesigning Online Engagement to Collaborate with Your Community
Designing Online Engagement to Collaborate with Your Community
NTEN
 
Anatomiadelosgrandesvasos 140512182826-phpapp01
Anatomiadelosgrandesvasos 140512182826-phpapp01Anatomiadelosgrandesvasos 140512182826-phpapp01
Anatomiadelosgrandesvasos 140512182826-phpapp01
DaniJesus Anillo Quintana
 
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
pamela
 
AdvancedSearch101
AdvancedSearch101AdvancedSearch101
AdvancedSearch101
Troy Hitt
 
Letter for internship (1)
Letter for internship (1)Letter for internship (1)
Letter for internship (1)
badiuzaman
 
インタビュー記事
インタビュー記事インタビュー記事
インタビュー記事
Nakayasu
 

En vedette (19)

Haskell is Not For Production and Other Tales
Haskell is Not For Production and Other TalesHaskell is Not For Production and Other Tales
Haskell is Not For Production and Other Tales
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Efficient Immutable Data Structures (Okasaki for Dummies)
Efficient Immutable Data Structures (Okasaki for Dummies)Efficient Immutable Data Structures (Okasaki for Dummies)
Efficient Immutable Data Structures (Okasaki for Dummies)
 
Tugas ekonomi islam
Tugas ekonomi islamTugas ekonomi islam
Tugas ekonomi islam
 
Adv 420 vogue Megan Dacey
Adv 420 vogue Megan Dacey Adv 420 vogue Megan Dacey
Adv 420 vogue Megan Dacey
 
Rhona Hutton
Rhona HuttonRhona Hutton
Rhona Hutton
 
Blue Ocean Strategy - Case Seats2meet.com
Blue Ocean Strategy - Case Seats2meet.comBlue Ocean Strategy - Case Seats2meet.com
Blue Ocean Strategy - Case Seats2meet.com
 
Robotique Quebec
Robotique QuebecRobotique Quebec
Robotique Quebec
 
PRIV by BlackBerry Secure Android Smartphone Advertising Images
PRIV by BlackBerry Secure Android Smartphone Advertising ImagesPRIV by BlackBerry Secure Android Smartphone Advertising Images
PRIV by BlackBerry Secure Android Smartphone Advertising Images
 
Designing Online Engagement to Collaborate with Your Community
Designing Online Engagement to Collaborate with Your CommunityDesigning Online Engagement to Collaborate with Your Community
Designing Online Engagement to Collaborate with Your Community
 
Anatomiadelosgrandesvasos 140512182826-phpapp01
Anatomiadelosgrandesvasos 140512182826-phpapp01Anatomiadelosgrandesvasos 140512182826-phpapp01
Anatomiadelosgrandesvasos 140512182826-phpapp01
 
Image180314132400
Image180314132400Image180314132400
Image180314132400
 
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
Impacto de las TICs en la cultura de la mediación a distancia para la educaci...
 
AdvancedSearch101
AdvancedSearch101AdvancedSearch101
AdvancedSearch101
 
Karen Rojas
Karen RojasKaren Rojas
Karen Rojas
 
Letter for internship (1)
Letter for internship (1)Letter for internship (1)
Letter for internship (1)
 
Control de Asistencia (Presencia), Planificacion de Horarios para la contrucción
Control de Asistencia (Presencia), Planificacion de Horarios para la contrucciónControl de Asistencia (Presencia), Planificacion de Horarios para la contrucción
Control de Asistencia (Presencia), Planificacion de Horarios para la contrucción
 
インタビュー記事
インタビュー記事インタビュー記事
インタビュー記事
 
amoxicilin determination by Hplc .prepared by :Razhan Salah othman
amoxicilin determination by Hplc .prepared by :Razhan Salah othman amoxicilin determination by Hplc .prepared by :Razhan Salah othman
amoxicilin determination by Hplc .prepared by :Razhan Salah othman
 

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

Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
jhchabran
 
Php tutorial handout
Php tutorial handoutPhp tutorial handout
Php tutorial handout
SBalan Balan
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Luis Curo Salvatierra
 

Similaire à Pursuing the Strong, Not So Silent Type: A Haskell Story (20)

Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
 
Speed Things Up with Transients
Speed Things Up with TransientsSpeed Things Up with Transients
Speed Things Up with Transients
 
Adventures in Optimization
Adventures in OptimizationAdventures in Optimization
Adventures in Optimization
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Php 101: PDO
Php 101: PDOPhp 101: PDO
Php 101: PDO
 
PHPSpec BDD for PHP
PHPSpec BDD for PHPPHPSpec BDD for PHP
PHPSpec BDD for PHP
 
Php tutorial handout
Php tutorial handoutPhp tutorial handout
Php tutorial handout
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Mongo à la Resque
Mongo à la ResqueMongo à la Resque
Mongo à la Resque
 
Drupal & javascript
Drupal & javascriptDrupal & javascript
Drupal & javascript
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móviles
 
Difference between mysql_fetch_array and mysql_fetch_assoc in PHP
Difference between mysql_fetch_array and mysql_fetch_assoc in PHPDifference between mysql_fetch_array and mysql_fetch_assoc in PHP
Difference between mysql_fetch_array and mysql_fetch_assoc in PHP
 

Dernier

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 

Dernier (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

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

  • 1. Pursuing the strong, not so silent type A Haskell story by Katie Miller (@codemiller) Software Engineer at Facebook
  • 2.
  • 3. "The limits of my language mean the limits of my world" - Ludwig Wittgenstein
  • 5. Source: Ruin Raider on Flickr, CC BY-NC-ND 2.0
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. more than 1 million requests/second
  • 12. 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  
  • 14. FXL
  • 18. HaskellSpammer  =      If  (TalkingAboutHaskell(postContent)  &&              NumCommonFriends(userId,  friendId)  <  5  &&              MostFriendsLikeRuby(friendId))          Then  BlockAction  Else  @[]   NumCommonFriends(x,  y)  =      Length(Intersect(FriendsOf(x),  FriendsOf(y)))  
  • 20.
  • 25. haskellSpammer  ::  Haxl  Bool   haskellSpammer  =        talkingAboutHaskell  .&&      numCommonFriends  .<  5  .&&      mostFriendsLikeRuby      where      mostFriendsLikeRuby  =  do          friends  <-­‐  getFriends          rubyFriends  <-­‐  filterM  friendLikesRuby  friends          return  (length  rubyFriends  >=              length  friends  `div`  2)      friendLikesRuby  friend  =          hasAssoc  friend  likeAssoc  rubyPage
  • 27. hasAssoc  ::  Int  -­‐>  Int  -­‐>  Int  -­‐>  Bool   hasAssoc  id  assoc  target  =  ...
  • 28. hasAssoc  ::  Int  -­‐>  Int  -­‐>  Int  -­‐>  Bool   hasAssoc  id  assoc  target  =  ... newtype  Id  =  Id  Int   newtype  AssocId  =  AssocId  Int
  • 29. 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  =  ...
  • 30. data  Language  =  Ruby  |  Haskell  |  Php
  • 31. data  Language  =  Ruby  |  Haskell  |  Php likesLanguage  ::  Language  -­‐>  Id  -­‐>  Bool
  • 32. data  Language  =  Ruby  |  Haskell  |  Php likesLanguage  ::  Language  -­‐>  Id  -­‐>  Bool likesLanguage  Ruby  userId  =      hasAssoc  userId  likesAssoc  1995  ||      hasAssoc  userId  likesAssoc  2005
  • 33. data  Language  =  Ruby  |  Haskell  |  Php likesLanguage  ::  Language  -­‐>  Id  -­‐>  Bool likesLanguage  Ruby  userId  =      hasAssoc  userId  likesAssoc  1995  ||      hasAssoc  userId  likesAssoc  2005 likesLanguage  Haskell  userId  =      hasAssoc  userId  likesAssoc  42
  • 34. data  Language  =  Ruby  |  Haskell  |  Php likesLanguage  ::  Language  -­‐>  Id  -­‐>  Bool likesLanguage  Ruby  userId  =      hasAssoc  userId  likesAssoc  1995  ||      hasAssoc  userId  likesAssoc  2005 likesLanguage  Haskell  userId  =      hasAssoc  userId  likesAssoc  42 likesLanguage  Php  _  =      False
  • 37.
  • 38. Is Haskell a panacea?
  • 39. blockAustralians  ::  Haxl  SyncResponses   blockAustralians  =  do      textMap  <-­‐  textArr      let  text  =  HashMap.lookupDefault  ""  "main_text"  textMap              numBadWords      =  length  $  filter  (`Text.isInfixOf`  text)  aussieTerms              numBadPhrases  =  length  $  filter  (`Text.isInfixOf`  text)  aussieSayings      if  numBadWords  <  2  &&  numBadPhrases  <=  0      then  return  noResponses      else              if  numBadWords  <  4  &&  numBadPhrases  <  2              then  return  requireCaptcha              else                      if  numBadWords  <  5  &&  numBadPhrases  <  3                      then  return  $  responses  [warnUser,  requireCaptcha]                      else                              if  numBadWords  <  7  &&  numBadPhrases  <  4                              then  return  warnUser                              else                                      if  numBadWords  <  8  &&  numBadPhrases  <  5                                      then  return  $  responses  [warnUser,  blockAccess]                                      else                                              if  numBadWords  <  10  &&  numBadPhrases  <  6                                              then  return  blockAccess                                              else                                                      if  numBadWords  <  13  &&  numBadPhrases  <  7                                                      then  return  $  responses                                                                        [  blockAccess                                                                        ,  enrollInFakeAccountCheckpoint                                                                        ]                                                      else  return  $  responses                                                                        [  blockAccess                                                                        ,  enrollInFakeAccountCheckpoint                                                                        ,  requireCaptcha                                                                        ]          where              aussieTerms  =                      [  "Acca  Dacca"                      ,  "ambo"                      ,  "arvo"                      ,  "Aussie"                      ,  "bangaroo"
  • 40. blockAustralians  ::  Haxl  SyncResponses   blockAustralians  =  do      textMap  <-­‐  textArr      let  text  =  HashMap.lookupDefault  ""  "main_text"  textMap              numBadWords      =  length  $  filter  (`Text.isInfixOf`  text)  aussieTerms              numBadPhrases  =  length  $  filter  (`Text.isInfixOf`  text)  aussieSayings      if  numBadWords  <  2  &&  numBadPhrases  <=  0      then  return  noResponses      else              if  numBadWords  <  4  &&  numBadPhrases  <  2              then  return  requireCaptcha              else                      if  numBadWords  <  5  &&  numBadPhrases  <  3                      then  return  $  responses  [warnUser,  requireCaptcha]                      else                              if  numBadWords  <  7  &&  numBadPhrases  <  4                              then  return  warnUser                              else                                      if  numBadWords  <  8  &&  numBadPhrases  <  5                                      then  return  $  responses  [warnUser,  blockAccess]                                      else                                              if  numBadWords  <  10  &&  numBadPhrases  <  6                                              then  return  blockAccess                                              else                                                      if  numBadWords  <  13  &&  numBadPhrases  <  7                                                      then  return  $  responses                                                                        [  blockAccess                                                                        ,  enrollInFakeAccountCheckpoint                                                                        ]                                                      else  return  $  responses                                                                        [  blockAccess                                                                        ,  enrollInFakeAccountCheckpoint                                                                        ,  requireCaptcha                                                                        ]          where              aussieTerms  =                      [  "Acca  Dacca"                      ,  "ambo"                      ,  "arvo"                      ,  "Aussie"                      ,  "bangaroo"
  • 44. 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
  • 45. 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
  • 46. The End by Katie Miller (@codemiller) Software Engineer at Facebook