Using Haskell at Bdellium
|
|
- Jonas O’Brien’
- 6 years ago
- Views:
Transcription
1 Using Haskell at Bdellium Parallelism, Lenses, Pipes and Industry Report
2 A note about me (Fredrik Olsen) Studied Engineering Physics at LTH Started working for Bdellium in 2011
3 We help business grow Developing tools that deliver new services Retirement Plan Rails Haskell Optimizer Fund Rating Security Clustering Data-Driven Decision Making
4 Why functional programming?
5 Why we like Haskell at Bdellium Expressive type system, allows descriptions of data Very good support for parallelism and concurrency Easier to get correct software, implementations look more like math Developer happiness and easy hiring Good community (IRC, Mailinglist, Stackoverflow, Reddit)
6 Parallelism and concurrency
7 Parallelism and concurrency Parallel and Concurrent Programming in Haskell by Simon Marlow Both parallelism and concurrency is obviously growing more important all the time. There are a lot of different ways to do both parallelism and concurrency in Haskell.
8 Parallelism and concurrency Multiple cores for performance Multiple threads for modularity of interaction Parallelism Concurrency Pure, Deterministic Effectful
9 Parallelism Eval Monad, rpar and rseq Strategies Par Monad Data Parallel Programming with Repa GPU Programming with Accelerate Concurrency Threads and MVars Software Transactional Memory Distributed Concurrency with Cloud Haskell (like Erlang)
10 Parallelism - rpar and rseq as building blocks do a <- rpar a b <- rpar b return (a,b ) do a <- rpar a b <- rseq b return (a,b ) Example 1 a do a <- rpar a b <- rseq b rseq a return (a,b ) do a <- rpar a b <- rpar b rseq a rseq b return (a,b ) return b
11 Parallelism - rpar and rseq as building blocks do a <- rpar a b <- rpar b return (a,b ) do a <- rpar a b <- rseq b return (a,b ) do a <- rpar a b <- rseq b rseq a return (a,b ) do a <- rpar a b <- rpar b rseq a rseq b return (a,b ) Example 2 b return a
12 Parallelism - rpar and rseq as building blocks do a <- rpar a b <- rpar b return (a,b ) do a <- rpar a b <- rseq b return (a,b ) do a <- rpar a b <- rseq b rseq a return (a,b ) do a <- rpar a b <- rpar b rseq a rseq b return (a,b ) Example 3 b a return
13 Parallelism - rpar and rseq as building blocks do a <- rpar a b <- rpar b return (a,b ) do a <- rpar a b <- rseq b return (a,b ) do a <- rpar a b <- rseq b rseq a return (a,b ) do a <- rpar a b <- rpar b rseq a rseq b return (a,b ) Example 4 b a return
14 Parallelism - Control.Parallel.Strategies Tuple Strategies seqpair, parpair, General Traversals seqtraverse, partraverse List strategies seqlist, parlist, parmap, parlistchunk, Possible (and not very hard) to build own strategies
15 Parallelism - Control.Parallel.Strategies Sequential version -- Create forecasts for every particular participant / design combination. assignforecasts :: Inputs -> [Participant] assignforecasts ins = map create (ins^.participants) Parallel version -- Create forecasts for every particular participant / design combination. assignforecasts :: Inputs -> [Participant] assignforecasts ins = map create (ins^.participants) `using` parlist rdeepseq
16 Parallelism - Par monad Using rpar, rseq and strategies might quickly lead to having to learn evaluation order, garbage collection and a wealth of other subjects in order to increase performance. Par monad aims to simplify the process and almost lets you write code that looks a bit like imperative code. Just like Strategies defines common tasks in the library, such as parmap etc fork :: Par () -> Par () data IVar a -- instance Eq new :: Par (IVar a) put :: NFData a => IVar a -> a -> Par () get :: IVar a -> Par a
17 Parallelism - Par monad runpar $ do v1 <- new v2 <- new fork $ put v1 (f x) fork $ put v2 (g x) get v1 get v2 return (v1 + v2) We don t have to think about when something is evaluated. Put is fully strict put :: NFData a => IVar a -> a -> Par () Computation can be seen as a data flow graph. Nodes without dependencies between them can be evaluated in parallel.
18 Parallelism - Repa and Accelerate Libraries for automatic parallelisation. Repa uses unboxed vectors, great for any computation that can be expressed as matrices. Accelerate very similar to Repa but is a DSL for GPU programming. Compiles part of code to CUDA for sending to GPU.
19 Concurrency - The building blocks forkio :: IO () -> IO ThreadId newemptymvar :: IO (MVar a) takemvar :: MVar a -> IO a putmvar :: MVar a -> a -> IO () MVars are single-value communication channels. A box than can be full or empty. Example stolen from Simon Marlow do m1 <- newemptymvar m2 <- newemptymvar forkio $ do r <- geturl " putmvar m1 r forkio $ do r <- geturl " putmvar m2 r r1 <- takemvar m1 r2 <- takemvar m2 return (r1,r2)
20 Concurrency - Control.Concurrent.Chan newchan :: IO (Chan a) writechan :: Chan a -> a -> IO () readchan :: Chan a -> IO a Abstraction on top of MVars to provide full communication channels. We re still in low-level message-passing. Can be hard to get right.
21 Concurrency - Control.Monad.STM data TVar a -- abstract newtvar :: STM (TVar a) readtvar :: TVar a -> STM a writetvar :: TVar a -> a -> STM () Provides atomic actions, transactions, that are composable Does not block, but does provide a way to simulate blocking, namely to retry transactions until some condition is met. (Does not busy-wait but waits until some change has been made to the var) We can get channels with STM as well.
22 Concurrency - Control.Distributed.Process (aka Cloud Haskell) Distributed concurrency, a.k.a. Erlang in Haskell Includes process management and communication methods. (With local or Azure backends, more coming) Automatic node discovery. Has successfully seen some real-world applications with big server farms.
23 Libraries are what makes a language viable
24 The two most useful libraries we use Lens by Edward Kmett Pipes by Gabriel Gonzalez hackage.haskell.org/package/lens hackage.haskell.org/package/pipes
25 A brief introduction to Lenses Courtesy of Cartesian Closed Comic
26 Why do we want lenses? A lens provides access into the middle of a data structure A lens is a first-class value, meaning you can pass it around to functions just as any other value. Lenses are composable, so we can take several lenses and make a lens out of them. Awesome images are stolen from Simon Peyton Jones talk about Lenses as Haskell exchange. Go watch his talk if you want a more thorough introduction.
27 Why do we want lenses? How do you get / set values in these data structures? data Person = Person { name :: String, addr :: Address, salary :: Int } data Address = Address { road :: String, city :: String, postcode :: String } getname :: Person -> String getname p = name p get :: (s -> a) -> s -> a get property structure = property structure getcity :: Person -> String getcity p = city (addr p) getdeep :: (s1 -> s2) -> (s2 -> a) -> s1 -> a getdeep prop1 prop2 structure = prop2 (prop1 structure) >>> getdeep addr city == get (addr.city)
28 Why do we want lenses? How do you get / set values in these data structures? data Person = Person { name :: String, addr :: Address, salary :: Int } data Address = Address { road :: String, city :: String, postcode :: String } setname :: String -> Person -> Person setname n p = p { name = n } setpostcode :: String -> Person -> Person setpostcode pc p = p { addr = addr p { postcode = pc }} -- UGLY set :: (s -> a) -> a -> s -> s set prop n p = p { prop = n } LensExample.hs:15:20: `prop' is not a (visible) constructor field name
29 With Control.Lens we can simplify setpostcode, setpostcode', setpostcode'' :: String -> Person -> Person setpostcode pc p = set (addr.postcode) pc p setpostcode' = set (addr.postcode) setpostcode'' pc p = p & addr.postcode.~ pc getpostcode :: Person -> String getpostcode p = p^.addr.postcode
30 How we use Lenses in practice We have a lot of nested data structures so we make heavy use of the accessor methods. p^.assets p^.forecast.retiresat p^.forecast.current.gapanalysis p^.forecast.optimized.projectedfunding.income.percent Lenses make traversals trivial -- sum of all unconstsalary records sumof (accs.traverse.unconstsalary) paccs -- maximum forecastsalary in the first 36 months maximumof (accs.taking 36 traverse.forecastsalary) paccs -- a list of the RRR for each participant under the current plan design ps^..folded.forecast.current.projectedfunding.income.percent
31 A brief introduction to Pipes One of many libraries for stream programming in Haskell. Dealing with long-running, complex or Lazy IO in Haskell can be very difficult. Pipes provides a clean and simple API to provide effectful, streaming, and composable programming.
32 Why do we want pipes? Lazy IO is especially hard to get right withfile "hello.txt" ReadMode (hgetcontents >=> print) >>> "Hello world" withfile "hello.txt" ReadMode hgetcontents >>= print >>> "" IO is difficult to decompose and re-use. Most attempts result in some sort of pipeline, whether explicit or not.
33 Example of decomposing echo program main = do eof <- iseof unless eof $ do str <- getline putstrln (transform str) main transform :: String -> String transform = reverse
34 Example of decomposing echo program main = do eof <- iseof unless eof $ do str <- getline putstrln (transform str) main transform :: String -> String transform = reverse main = readdata transform printer readdata :: (String -> String) -> (String -> IO ()) -> IO () readdata t p = do eof <- iseof unless eof $ do str <- getline p $ t str readdata t p printer :: String -> IO () printer s = putstrln s transform :: String -> String transform = reverse Still very tightly coupled and readdata handles a lot of logic not specific to reading. We can improve, but it s a lot of work
35 The Pipes way - the types document and constrain main = runeffect mainpipeline mainpipeline :: Effect IO () mainpipeline = readdata >-> transform >-> printer readdata :: Producer String IO () readdata = forever $ do eof <- lift iseof unless eof $ do str <- lift getline yield str transform :: Monad m => Pipe String String m () transform = forever $ do str <- await yield $ reverse str printer :: Consumer String IO () printer = forever $ do str <- await lift $ putstrln str
36 Why do we want pipes? Simplifies construction of modular data pipelines, whether your application streams or not. Solves the Lazy IO problem. Comes with batteries included; a lot of default producers, consumers and pipes out of the box. Producers - stdinln, fromhandle Consumers - stdoutln, tohandle Pipes - take n, takewhile, drop n, scanl Folds - all, null, last
37 How we use Pipes in practice -- Run the pipeline. runrsa :: RunInformation -> IO () runrsa runinfo = runeffect $ rsapipeline runinfo -- Assemble the RSA pipeline. rsapipeline :: RunInformation -> Effect IO () rsapipeline runinfo = fetchrawinputs runinfo >-> preprocessinputs >-> addforecasts >-> createandwritereport runinfo -- Grab raw inputs from the database. fetchrawinputs :: RunInformation -> Producer RawInputs IO () -- Preprocess raw inputs and yield them downstream. preprocessinputs :: Monad m => Pipe RawInputs Inputs m () -- Augment inputs with participant forecasts and yield them downstream. addforecasts :: Monad m => Pipe Inputs Inputs m () -- Consume inputs, create a report document, and write it to the database. createandwritereport :: RunInformation -> Consumer Inputs IO ()
38 A word on the spread of Haskell Facebook uses Haskell in the Haxl project, a DSL to allow front-end developers write business logic that performs complex parallell computations in the back-end. Silk is a platform for sharing collections about anything, from your favorite coffee places to modernist painters to 3D printers Pioneering better e-learning. The Nordic market leading solution for e-signing of documents. Bump use a Haskell-based server, Angel, for process supervisor for all their backend systems, and for other infrastructure tasks.
39 Well-Typed - Consultancy AT&T - Network security Bank of America - Data processing Barclays Capital - An EDSL to specify exotic equity derivatives Ericsson AB - An EDSL for digital signal processing algorithms Functor AB - Static analysis Galois - Projects under contract for corporations and government clients in the demanding application areas of security, information assurance and cryptography Standard Chartered - Large group using Haskell for all aspects of its wholesale banking business Tsuru Capital - Operating an automated options trading system written in Haskell
40 Thank you for your time and attention
Bright The smart founder s copilot
A note about me SaaS data analytics Haskell for analytics, Rails for presentation Graduated Engineering Physics at LTH Bright The smart founder s copilot Bdellium Fugue Bright Functional Programming in
More informationLiU-FP2010 Part II: Lecture 7 Concurrency
LiU-FP2010 Part II: Lecture 7 Concurrency Henrik Nilsson University of Nottingham, UK LiU-FP2010 Part II: Lecture 7 p.1/36 This Lecture A concurrency monad (adapted from Claessen (1999)) Basic concurrent
More informationSimon Peyton Jones (Microsoft Research) Tokyo Haskell Users Group April 2010
Simon Peyton Jones (Microsoft Research) Tokyo Haskell Users Group April 2010 Geeks Practitioners 1,000,000 10,000 100 1 The quick death 1yr 5yr 10yr 15yr Geeks Practitioners 1,000,000 10,000 100 The slow
More informationPARALLEL AND CONCURRENT PROGRAMMING IN HASKELL
Introduction Concurrent Haskell Data Parallel Haskell Miscellenous References PARALLEL AND CONCURRENT PROGRAMMING IN HASKELL AN OVERVIEW Eva Burrows BLDL-Talks Department of Informatics, University of
More informationMulticore programming in Haskell. Simon Marlow Microsoft Research
Multicore programming in Haskell Simon Marlow Microsoft Research A concurrent web server server :: Socket -> IO () server sock = forever (do acc
More informationComposable Shared Memory Transactions Lecture 20-2
Composable Shared Memory Transactions Lecture 20-2 April 3, 2008 This was actually the 21st lecture of the class, but I messed up the naming of subsequent notes files so I ll just call this one 20-2. This
More informationA short introduction to concurrency and parallelism in Haskell
A short introduction to concurrency and parallelism in Haskell Matteo Pradella matteo.pradella@polimi.it DEIB, Politecnico di Milano 2012-2015 Explicit (classical) concurrency: Threads and MVars As in
More informationReferences. Monadic I/O in Haskell. Digression, continued. Digression: Creating stand-alone Haskell Programs
References Monadic I/O in Haskell Jim Royer CIS 352 March 6, 2018 Chapter 18 of Haskell: the Craft of Functional Programming by Simon Thompson, Addison-Wesley, 2011. Chapter 9 of Learn you a Haskell for
More informationCOMP3151/9151 Foundations of Concurrency Lecture 8
1 COMP3151/9151 Foundations of Concurrency Lecture 8 Transactional Memory Liam O Connor CSE, UNSW (and data61) 8 Sept 2017 2 The Problem with Locks Problem Write a procedure to transfer money from one
More informationHaskell for (E)DSLs. Andres Löh. Functional Programming exchange, 16 March Well-Typed LLP
Haskell for (E)DSLs Andres Löh Well-Typed LLP Functional Programming exchange, 16 March 2012 My completely biased world view Languages are everywhere! My completely biased world view Languages are everywhere!
More informationParallel & Concurrent Haskell 1: Basic Pure Parallelism. Simon Marlow (Microsoft Research, Cambridge, UK)
Parallel & Concurrent Haskell 1: Basic Pure Parallelism Simon Marlow (Microsoft Research, Cambridge, UK) Background The parallelism landscape is getting crowded Every language has their own solution(s)
More informationCOMP3151/9151 Foundations of Concurrency Lecture 8
1 COMP3151/9151 Foundations of Concurrency Lecture 8 Liam O Connor CSE, UNSW (and data61) 8 Sept 2017 2 Shared Data Consider the Readers and Writers problem from Lecture 6: Problem We have a large data
More informationImplementing Concurrent Futures in Concurrent Haskell
Implementing Concurrent Futures in Concurrent Haskell Working Draft David Sabel Institut für Informatik Johann Wolfgang Goethe-Universität Postfach 11 19 32 D-60054 Frankfurt, Germany sabel@ki.informatik.uni-frankfurt.de
More informationIntroduction to Functional Programming and Haskell. Aden Seaman
Introduction to Functional Programming and Haskell Aden Seaman Functional Programming Functional Programming First Class Functions Expressions (No Assignment) (Ideally) No Side Effects Different Approach
More informationParallelizing Maximal Clique Enumeration in Haskell
Parallelizing Maximal Clique Enumeration in Haskell Andres Löh (joint work with Toni Cebrián) Well-Typed LLP 7 February 2012 Background: The Parallel GHC Project The Parallel GHC Project Currently the
More informationCSE 230. Concurrency: STM. Slides due to: Kathleen Fisher, Simon Peyton Jones, Satnam Singh, Don Stewart
CSE 230 Concurrency: STM Slides due to: Kathleen Fisher, Simon Peyton Jones, Satnam Singh, Don Stewart The Grand Challenge How to properly use multi-cores? Need new programming models! Parallelism vs Concurrency
More informationLVars: Lattice-based Data Structures for Deterministic Parallelism. FHPC 13, Boston, MA, USA September 23, 2013
LVars: Lattice-based Data Structures for Deterministic Parallelism Lindsey Kuper and Ryan Newton Indiana University FHPC 13, Boston, MA, USA September 23, 2013 What does this program evaluate to? p = do
More informationLightweight Concurrency Primitives for GHC. Peng Li Simon Peyton Jones Andrew Tolmach Simon Marlow
Lightweight Concurrency Primitives for GHC Peng Li Simon Peyton Jones Andrew Tolmach Simon Marlow The Problem GHC has rich support for concurrency & parallelism: Lightweight threads (fast) Transparent
More informationConcurrent and Multicore Haskell
Concurrent and Multicore Haskell These slides are licensed under the terms of the Creative Commons Attribution-Share Alike 3.0 United States License. 1 Concurrent Haskell For responsive programs that multitask
More informationJVM ByteCode Interpreter
JVM ByteCode Interpreter written in Haskell (In under 1000 Lines of Code) By Louis Jenkins Presentation Schedule ( 15 Minutes) Discuss and Run the Virtual Machine first
More informationHaskell Monads CSC 131. Kim Bruce
Haskell Monads CSC 131 Kim Bruce Monads The ontological essence of a monad is its irreducible simplicity. Unlike atoms, monads possess no material or spatial character. They also differ from atoms by their
More information!!"!#"$%& Atomic Blocks! Atomic blocks! 3 primitives: atomically, retry, orelse!
cs242! Kathleen Fisher!! Multi-cores are coming!! - For 50 years, hardware designers delivered 40-50% increases per year in sequential program speed.! - Around 2004, this pattern failed because power and
More informationCOS 326 David Walker. Thanks to Kathleen Fisher and recursively to Simon Peyton Jones for much of the content of these slides.
COS 326 David Walker Thanks to Kathleen Fisher and recursively to Simon Peyton Jones for much of the content of these slides. Optional Reading: Beautiful Concurrency, The Transactional Memory / Garbage
More informationIO Monad (3D) Young Won Lim 1/18/18
Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationThe future is parallel The future of parallel is declarative. Simon Peyton Jones Microsoft Research
The future is parallel The future of parallel is declarative Simon Peyton Jones Microsoft Research Thesis The free lunch is over. Muticores are here. We have to program them. This is hard. Yada-yada-yada.
More informationf() ! " Run a higher-priority task? ! " Yield the processor to another task because our ! " Use the processor for some other activity while
CS 410/510: Advanced Programming Continuing a Computation: Continuations Mark P Jones Portland State University 1 Standard nested function call pattern 2 Continuing a Computation: What might we want to
More informationCS 410/510: Advanced Programming
CS 410/510: Advanced Programming Continuations Mark P Jones Portland State University 1 Continuing a Computation: f() g() h() Standard nested function call pattern 2 Continuing a Computation: f() g() h()
More informationHaskell Review COMP360
Haskell Review COMP360 Some people talk in their sleep. Lecturers talk while other people sleep Albert Camus Remaining Schedule Friday, April 7 Haskell Monday, April 10 Logic Programming read chapter 12
More informationIO Monad (3C) Young Won Lim 8/23/17
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationIO Monad (3C) Young Won Lim 1/6/18
Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationT Special course High-Performance Embedded Computing (HPEC) Autumn 2013 (I-II), Lecture 6
Advanced parallelism T-106.6200 Special course High-Performance Embedded Computing (HPEC) Autumn 2013 (I-II), Lecture 6 Vesa Hirvisalo & Kevin Hammond (Univ. of St. Andrews) Today Introduction to skeletons
More informationDATA PARALLEL PROGRAMMING IN HASKELL
DATA PARALLEL PROGRAMMING IN HASKELL An Overview Manuel M T Chakravarty University of New South Wales INCLUDES JOINT WORK WITH Gabriele Keller Sean Lee Roman Leshchinskiy Ben Lippmeier Trevor McDonell
More informationTEST CONCURRENT PROGRAMMING. code: date: 19 June 2015 time:
TEST CONCURRENT PROGRAMMING code: 01400537 date: 19 June 015 time: 13.45 16.45 - This is an open book examination. You are allowed to have a copy of Java Concurrency in Practice, and a copy of the (unannotated)
More informationHaskell in the corporate environment. Jeff Polakow October 17, 2008
Haskell in the corporate environment Jeff Polakow October 17, 2008 Talk Overview Haskell and functional programming System description Haskell in the corporate environment Functional Programming in Industry
More informationBackground Type Classes (1B) Young Won Lim 6/28/18
Background Type Classes (1B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
More informationA Deterministic Multi-Way Rendezvous Library for Haskell
A Deterministic Multi-Way Rendezvous Library for Haskell Nalini Vasudevan Department of Computer Science Columbia University New York, USA naliniv@cs.columbia.edu Stephen A. Edwards Department of Computer
More informationConcurrent Programming Method for Embedded Systems
Concurrent Programming Method for Embedded Systems Norbert Schramm UVA, 24000 Subotica, Serbia norbert.schramm@gmail.com Anita Sabo Polytechnical Engineering College Subotica M. Oreškovića 16, 24000 Subotica,
More informationSoftware Transactional Memory
Software Transactional Memory Madhavan Mukund Chennai Mathematical Institute http://www.cmi.ac.in/ madhavan Formal Methods Update Meeting TRDDC, Pune 19 July 2008 The challenge of concurrent programming
More informationIntroduction to Haskell
Introduction to Haskell Matt Mullins Texas A&M Computing Society October 6, 2009 Matt Mullins (TACS) Introduction to Haskell October 6, 2009 1 / 39 Outline Introduction to Haskell Functional Programming
More informationCSE 230. Parallelism. The Grand Challenge. How to properly use multi-cores? Need new programming models! Parallelism vs Concurrency
The Grand Challenge CSE 230 Parallelism How to properly use multi-cores? Need new programming models! Slides due to: Kathleen Fisher, Simon Peyton Jones, Satnam Singh, Don Stewart Parallelism vs Concurrency
More informationGHC(STG,Cmm,asm) illustrated
GHC(STG,Cmm,asm) illustrated for hardware persons exploring some mental models and implementations Takenobu T. Rev. 0.02.0 WIP Any sufficiently advanced technology is indistinguishable from magic. Arthur
More informationCombinatorrent. Writing Haskell code for fun and profit. Jesper Louis Andersen May, 2012
Combinatorrent Writing Haskell code for fun and profit Jesper Louis Andersen jesper.louis.andersen@gmail.com May, 2012 History Combinatorrent -AbittorrentclientinHaskell I GHC (Glasgow Haskell Compiler)
More informationDavid Walker. Thanks to Kathleen Fisher and recursively to Simon Peyton Jones for much of the content of these slides.
David Walker Thanks to Kathleen Fisher and recursively to Simon Peyton Jones for much of the content of these slides. Optional Reading: Beautiful Concurrency, The Transactional Memory / Garbage Collection
More informationAn Abstract Machine for Concurrent Haskell with Futures
An Abstract Machine for Concurrent Haskell with Futures David Sabel Goethe-University, Frankfurt am Main, Germany ATPS 12, Berlin, Germany Motivation Concurrent Haskell (Peyton Jones, Gordon, Finne 1996)
More informationLightweight Concurrency in GHC. KC Sivaramakrishnan Tim Harris Simon Marlow Simon Peyton Jones
Lightweight Concurrency in GHC KC Sivaramakrishnan im Harris Simon Marlow Simon Peyton Jones 1 GHC: Concurrency and Parallelism forkio MVars Safe foreign calls Bound threads Par Monad Asynchronous exceptions
More informationHaskell in the Software Industry
Haskell in the Software Industry What is Haskell? Haskell in a nutshell Haskell is a pure, non-strict, statically typed, garbage collected, general purpose, functional programming language. Early history
More informationFunctional Programming Language Haskell
Functional Programming Language Haskell Mohammed Aslam CIS 24 Prof. Kopec Presentation: 03 Date: 05/05/2003 Haskell is a general purpose, purely functional programming language named after the logician
More informationCS The IO Monad. Slides from John Mitchell, K Fisher, and S. Peyton Jones
CS 242 2012 The IO Monad Slides from John Mitchell, K Fisher, and S. Peyton Jones Reading: Tackling the Awkward Squad, Sections 1-2 Real World Haskell, Chapter 7: I/O Beauty... Functional programming is
More informationLocks and Threads and Monads OOo My. Stephan Bergmann StarOffice/OpenOffice.org Sun Microsystems
Locks and Threads and Monads OOo My Stephan Bergmann StarOffice/OpenOffice.org Sun Microsystems Locks and Threads and Monads OOo My 1 - Tomorrow's hardware... 2 -...and today's software 3 - Stateful vs.
More informationText. Parallelism Gabriele Keller University of New South Wales
Text Parallelism Gabriele Keller University of New South Wales Programming Languages Mentoring Workshop 2015 undergrad Karslruhe & Berlin, Germany PhD Berlin & Tsukuba, Japan University of Technology Sydney
More informationPrinciples of Programming Languages Topic: Functional Programming Professor L. Thorne McCarty Spring 2003
Principles of Programming Languages Topic: Functional Programming Professor L. Thorne McCarty Spring 2003 CS 314, LS, LTM: Functional Programming 1 Scheme A program is an expression to be evaluated (in
More informationComparing the Performance of Concurrent Linked-List Implementations in Haskell
Comparing the Performance of Concurrent Linked-List Implementations in Haskell Martin Sulzmann IT University of Copenhagen, Denmark martin.sulzmann@gmail.com Edmund S. L. Lam National University of Singapore,
More informationDynamic Cuda with F# HPC GPU & F# Meetup. March 19. San Jose, California
Dynamic Cuda with F# HPC GPU & F# Meetup March 19 San Jose, California Dr. Daniel Egloff daniel.egloff@quantalea.net +41 44 520 01 17 +41 79 430 03 61 About Us! Software development and consulting company!
More informationConservative Concurrency in Haskell
Conservative Concurrency in Haskell David Sabel and Manfred Schmidt-Schauß Goethe-University, Frankfurt am Main, Germany LICS 12, Dubrovnik, Croatia Motivation a View on Haskell Purely functional core
More informationSeq no more: Better Strategies for Parallel Haskell
Seq no more: Better Strategies for Parallel Haskell Simon Marlow Microsoft Research, Cambridge, UK simonmar@microsoft.com Patrick Maier Heriot-Watt University, Edinburgh, UK P.Maier@hw.ac.uk Hans-Wolfgang
More informationUsing Monads for Input and Output
L13-1 Using Monads for Input and Output Jan-Willem Laboratory for Computer Science M.I.T. November 4, 2002 Functional Languages and I/O L13-2 z := f(x) + g(y); In a functional language f and g can be evaluated
More informationOverview. Declarative Languages. General monads. The old IO monad. Sequencing operator example. Sequencing operator
Overview Declarative Languages D7012E: General monads in haskell Fredrik Bengtsson IO-monad sequencing operator monad class requirements on monad Monadic computation trivial example useful example The
More informationHaskell & functional programming, some slightly more advanced stuff. Matteo Pradella
Haskell & functional programming, some slightly more advanced stuff Matteo Pradella pradella@elet.polimi.it IEIIT, Consiglio Nazionale delle Ricerche & DEI, Politecnico di Milano PhD course @ UniMi - Feb
More informationProgramming in Haskell Aug Nov 2015
Programming in Haskell Aug Nov 2015 LECTURE 23 NOVEMBER 12, 2015 S P SURESH CHENNAI MATHEMATICAL INSTITUTE Summary of IO Actions of type IO t1, t1 -> IO t2, t1 -> t2 -> IO t3 etc. As opposed to pure functions
More informationHaskell Functional Programming
Haskell Functional Programming http://igm.univ-mlv.fr/~vialette/?section=teaching Stéphane Vialette LIGM, Université Paris-Est Marne-la-Vallée November 11, 2017 Everybody s talking about functional programming
More informationCompiling Parallel Algorithms to Memory Systems
Compiling Parallel Algorithms to Memory Systems Stephen A. Edwards Columbia University Presented at Jane Street, April 16, 2012 (λx.?)f = FPGA Parallelism is the Big Question Massive On-Chip Parallelism
More informationHaskell: From Basic to Advanced. Part 2 Type Classes, Laziness, IO, Modules
Haskell: From Basic to Advanced Part 2 Type Classes, Laziness, IO, Modules Qualified types In the types schemes we have seen, the type variables were universally quantified, e.g. ++ :: [a] -> [a] -> [a]
More informationProgramming Languages
Programming Languages Andrea Flexeder Chair for Theoretical Computer Science Prof. Seidl TU München winter term 2010/2011 Lecture 10 Side-Effects Main Points you should get: Why monads? What is a monad?
More informationCS 360: Programming Languages Lecture 10: Introduction to Haskell
CS 360: Programming Languages Lecture 10: Introduction to Haskell Geoffrey Mainland Drexel University Thursday, February 5, 2015 Adapted from Brent Yorgey s course Introduction to Haskell. Section 1 Administrivia
More informationF# for Industrial Applications Worth a Try?
F# for Industrial Applications Worth a Try? Jazoon TechDays 2015 Dr. Daniel Egloff Managing Director Microsoft MVP daniel.egloff@quantalea.net October 23, 2015 Who are we Software and solution provider
More informationAdvances in Programming Languages
O T Y H Advances in Programming Languages APL5: Further language concurrency mechanisms David Aspinall (including slides by Ian Stark) School of Informatics The University of Edinburgh Tuesday 5th October
More informationCollege Functors, Applicatives
College 2016-2017 Functors, Applicatives Wouter Swierstra with a bit of Jurriaan Hage Utrecht University Contents So far, we have seen monads define a common abstraction over many programming patterns.
More informationProfunctor Optics: Modular Data Accessors
Profunctor Optics: Modular Data Accessors Jeremy Gibbons (joint work with Matthew Pickering and Nicolas Wu) Spring Festival Workshop, Karuizawa, March 2017 Profunctor Optics 2 1. Overview lenses for access
More informationPhilipp Wille. Beyond Scala s Standard Library
Scala Enthusiasts BS Philipp Wille Beyond Scala s Standard Library OO or Functional Programming? Martin Odersky: Systems should be composed from modules. Modules should be simple parts that can be combined
More informationFunctional Languages. Hwansoo Han
Functional Languages Hwansoo Han Historical Origins Imperative and functional models Alan Turing, Alonzo Church, Stephen Kleene, Emil Post, etc. ~1930s Different formalizations of the notion of an algorithm
More informationChapter 0 : MVC review / Threading & Concurrency. CSCI 251 Android App Development
Chapter 0 : MVC review / Threading & Concurrency CSCI 251 Android App Development Part I: Model / View / Controller Review (courtesy of Prof. Lambert) TUI vs GUI Text-based I/O Sequential process Direct
More informationProgramming with Math and Logic
.. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing
More informationIntroduction to Programming: Lecture 19
Introduction to Programming: Lecture 19 K Narayan Kumar Chennai Mathematical Institute http://www.cmi.ac.in/~kumar 6 November 2012 Actions: More details Actions are terms of type IO a for some a. Actions:
More informationLazy Functional Programming in Haskell
Lazy Functional Programming in Haskell David Raymond Christiansen 25 November, 2013 What is Haskell? 2 What is Haskell? Pure functional language: no side effects 2 What is Haskell? Pure functional language:
More informationSequentialising a concurrent program using continuation-passing style
Sequentialising a concurrent program using continuation-passing style Juliusz Chroboczek Université de Paris-Diderot (Paris 7) jch@pps.jussieu.fr 28 January 2012 1/44 Outline Everything you ever wanted
More informationStop coding Pascal. Saturday, April 6, 13
Stop coding Pascal...emotional sketch about past, present and future of programming languages, Python, compilers, developers, Life, Universe and Everything Alexey Kachayev CTO at KitApps Inc. Open source
More informationIs Functional Programming (FP) for me? ACCU Conference 2008 Hubert Matthews
Is Functional Programming (FP) for me? ACCU Conference 2008 Hubert Matthews hubert@oxyware.com Overview of talk History of computing Types of problem, developers, solution, environments, managers Pros
More informationIteratee IO safe, practical, declarative input processing
Iteratee IO safe, practical, declarative input processing http://okmij.org/ftp/streams.html Utrecht, NL December 17, 2009 Updated for the November 2010 version 1 Outline Introduction Non-solutions: Handle-based
More informationdoi: / Composable Memory Transactions By Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy
doi:10.1145/1378704.1378725 Composable Memory Transactions By Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy Abstract Writing concurrent programs is notoriously difficult and is of increasing
More informationBox-and-arrow Diagrams
Box-and-arrow Diagrams 1. Draw box-and-arrow diagrams for each of the following statements. What needs to be copied, and what can be referenced with a pointer? (define a ((squid octopus) jelly sandwich))
More informationApplicative, traversable, foldable
Applicative, traversable, foldable Advanced functional programming - Lecture 3 Wouter Swierstra 1 Beyond the monad So far, we have seen how monads define a common abstraction over many programming patterns.
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Multithreading Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to large compute clusters Can perform multiple
More informationCommunicating Process Architectures in Light of Parallel Design Patterns and Skeletons
Communicating Process Architectures in Light of Parallel Design Patterns and Skeletons Dr Kevin Chalmers School of Computing Edinburgh Napier University Edinburgh k.chalmers@napier.ac.uk Overview ˆ I started
More informationAn Update on Haskell H/STM 1
An Update on Haskell H/STM 1 Ryan Yates and Michael L. Scott University of Rochester TRANSACT 10, 6-15-2015 1 This work was funded in part by the National Science Foundation under grants CCR-0963759, CCF-1116055,
More informationA Pragmatic Case For. Static Typing
A Pragmatic Case For Static Typing Slides available from github at: https://github.com/bhurt/presentations/blob/master /statictyping.odp Please Hold your Comments, Criticisms, Objections, Etc. To the end
More informationChapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes
Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,
More informationStreams in Java 8. Start programming in a more functional style
Streams in Java 8 Start programming in a more functional style Background Who am I? Tobias Coetzee I m a Technical Lead at BBD I present the Java Expert Level Certifications at BBD (EJB, JPA, etc.) I m
More informationRevisiting Software Transactional Memory in Haskell 1
Revisiting Software Transactional Memory in Haskell Matthew Le Rochester Institute of Technology ml995@cs.rit.edu Ryan Yates University of Rochester ryates@cs.rochester.edu Matthew Fluet Rochester Institute
More informationMostly functional programming does not work
Mostly functional programming does not work Alejandro Gómez-Londoño EAFIT University June 26, 2014 Introduction Conventional programming languages are large, complex, and inflexible. Their limited expressive
More informationFinding parallel functional pearls: Automatic parallel recursion scheme detection in Haskell functions via anti-unification
Accepted Manuscript Finding parallel functional pearls: Automatic parallel recursion scheme detection in Haskell functions via anti-unification Adam D. Barwell, Christopher Brown, Kevin Hammond PII: S0167-739X(17)31520-0
More informationPractical Type System Benefits
Practical Type System Benefits by Neil Brown neil@twistedsquare.com April 23, 2014 One of Haskell s key selling points is its type system. This article provides several practical examples of how the type
More informationMonad Background (3A) Young Won Lim 10/5/17
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationProgrammation Concurrente (SE205)
Programmation Concurrente (SE205) CM1 - Introduction to Parallelism Florian Brandner & Laurent Pautet LTCI, Télécom ParisTech, Université Paris-Saclay x Outline Course Outline CM1: Introduction Forms of
More informationEmbedded Domain Specific Languages in Idris Lecture 3: State, Side Effects and Resources
Embedded Domain Specific Languages in Idris Lecture 3: State, Side Effects and Resources Edwin Brady (ecb10@st-andrews.ac.uk) University of St Andrews, Scotland, UK @edwinbrady SSGEP, Oxford, 9th July
More informationMore on functional programming
More on functional programming Emphasis on Haskell (as a pure functional language) Input and output in Haskell Wrappers / contexts Monads chaining wrapped computations Maybe and lists as monads Return
More informationMonad P1 : Several Monad Types (4A) Young Won Lim 2/13/19
Monad P1 : Several Copyright (c) 2016-2019 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any
More informationConcepts of programming languages
Concepts of programming languages Lecture 7 Wouter Swierstra 1 Last time Relating evaluation and types How to handle variable binding in embedded languages? 2 DSLs: approaches A stand-alone DSL typically
More informationTransactional Memory on a Dataflow Architecture for Accelerating Haskell
Transactional Memory on a Dataflow Architecture for Accelerating Haskell ROBERTO GIORGI University of Siena Department of Information Engineering and Mathematics Via Roma 56, Siena ITALY giorgi@dii.unisi.it
More informationFunctional Programming. Pure Functional Languages
Functional Programming Pure functional PLs S-expressions cons, car, cdr Defining functions read-eval-print loop of Lisp interpreter Examples of recursive functions Shallow, deep Equality testing 1 Pure
More informationTeaching Functional Programming
Zoltán Horváth hz@inf.elte.hu lecturers: István Bozó, Zoltán Csörnyei, Andrea Kovács, Gábor Páli, Máté Tejfel, Melinda Tóth Faculty of Informatics, Eötvös Loránd University, Budapest 15th Workshop on Software
More information