Uniform Boilerplate and List Processing Or: Scrap Your Scary Types Neil Mitchell and Colin Runciman, Haskell Workshop, 2007 Simple generics (Haskell ’98)

Slides:



Advertisements
Similar presentations
C++ Development on Linux Agenda Introduction Editors Debuggers GUI IDEs Make Automake Exploring further.
Advertisements

Abuse Testing Laboratory Management Laboratory Management.
Natural Business Services for Construct Users Mark Barnard R&D Manager – Natural Business Services.
A Third Look At ML 1. Outline More pattern matching Function values and anonymous functions Higher-order functions and currying Predefined higher-order.
Effective Discovery Techniques In Computer Crime Cases.
Lesson One: The Beginning Chapter 2: Processing Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from built-in help reference.
CATCH: Case and Termination Checker for Haskell Neil Mitchell (Supervised by Colin Runciman)
Using Cabal and the Hackage Package Database. Hackage Hackage is a database of Haskell packages (or modules) written by others and available for public.
1 SWE Introduction to Software Engineering Lecture 22 – Architectural Design (Chapter 13)
CONTENT: A model for collaborative database building Trevor Bond Alan Cornish Washington State University Libraries.
0 PROGRAMMING IN HASKELL Chapter 11 - The Countdown Problem.
Transformation and Analysis of Haskell Source Code Neil Mitchell 
Enhancing open-source localization By Farzana Forhad Farzana Forhad May 20, 2010 Advisor: Dr. Chris Pollett Committee members: Dr. Robert Chun & Professor.
Stimulating reuse with an automated active code search tool Júlio Lins – André Santos (Advisor) –
A different approach to Middleware. The IGUANA Integration Engine Introduction Eliot Muir, CEO My role is 75% development Based in Toronto, Canada.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
Collections Management Museums EMu 3.1 / 3.2 – New Features EMu 3.1 / 3.2 New Features Bernard Marshall Chief Technology Officer KE Software.
CSE 528 Final Project Submission Dongli Zhang. Recent Due 10-Paper Survey due November 26 Send PDF file to BOTH Professor and TA Professor:
Hyrax Installation and Customization Dan Holloway James Gallagher.
ITM352 PHP and Dynamic Web Pages: Server Side Processing.
GIS Application in Firewall Security Log Visualization Juliana Lo.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
Playing with Haskell Data Neil Mitchell. Overview The “boilerplate” problem Haskell’s weakness (really!) Traversals and queries Generic traversals and.
Software Reuse Course: # The Johns-Hopkins University Montgomery County Campus Fall 2004 Session 6 Lecture # 5 – October 12, 2004.
DEV334 Creating Application Starting Points & Sharing Best Practices with Enterprise Templates Marc Gusmano Director of Emerging Technologies The Information.
Creating Data Marts from COBOL Files (ISAM to RDBMS)
Course Management System An application that can be added to a web server to create a flexible web-based environment for creating and managing online courses.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
By: Paul Hill Technology Coordinator Gwinn Area Community Schools.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
In addition to Word, Excel, PowerPoint, and Access, Microsoft Office® 2013 includes additional applications, including Outlook, OneNote, and Office Web.
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
Haskell. 2 GHC and HUGS Haskell 98 is the current version of Haskell GHC (Glasgow Haskell Compiler, version 7.4.1) is the version of Haskell I am using.
Presentation seminar on   Google Chrome OS is Linux based OS  Google Chrome is an open source, lightweight OS.  It is based.
Microsoft Office Communicator A General Introduction.
1 3. Computing System Fundamentals 3.1 Language Translators.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
Professor Michael J. Losacco CIS 1110 – Using Computers Database Management Chapter 9.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Data Management Console Synonym Editor
Roles in Software Development using Domain Specific Modelling Languages Holger Krahn, Bernhard Rumpe, Steven Völkel Software Systems Engineering Technische.
© Metadata Technology ESCWA SDMX Workshop Session: SDMX and a Re-usable Component Architecture.
Functional Programming Language OCaml Tutorial 科大 - 耶鲁联合研究中心
Hoogλe Finding Functions from Types Neil Mitchell haskell.org/hoogle community.haskell.org/~ndm/ [α]  [α]
A Third Look At ML Chapter NineModern Programming Languages, 2nd ed.1.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Module 8 : Configuration II Jong S. Bok
2nd March 2010IFIP WG 2.11 St Andrews1 Costing by construction Greg Michaelson School of Mathematical & Computer Sciences Heriot-Watt University.
© 2008 by Shawn Spiars; made available under the EPL v1.0 | March 17, 2008 Case Study – Phurnace Software and RCP Shawn Spiars Lead UI Developer Phurnace.
First Order Haskell Neil Mitchell York University λ.
Software Reuse Course: # The Johns-Hopkins University Montgomery County Campus Fall 2000 Session 4 Lecture # 3 - September 28, 2004.
Hoogle Neil Mitchell. Haskell Types 101 isURI :: String -> Bool (||) :: Bool -> Bool -> Bool or :: [Bool] -> Bool id :: a ->
Software Reuse Course: # The Johns-Hopkins University Montgomery County Campus Fall 2000 Lecture # 2 - September 14, 2004.
Session 1: Introduction to HTML Fall Today’s Agenda Talk about the functions of the Internet Cover useful terminology for today’s session HTML,
Content Management Systems. Agenda Week overview Web-page basics The why and what of CMS Typo3.
Haskell Chapter 5, Part II. Topics  Review/More Higher Order Functions  Lambda functions  Folds.
Directory Services CS5493/7493. Directory Services Directory services represent a technological breakthrough by integrating into a single management tool:
Plug-In Architecture Pattern. Problem The functionality of a system needs to be extended after the software is shipped The set of possible post-shipment.
Haskell With Go Faster Stripes Neil Mitchell. Catch: Project Overview Catch checks that a Haskell program won’t raise a pattern match error head [] =
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
Sung-Dong Kim Dept. of Computer Engineering, Hansung University Chapter 3 Programming Tools.
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
Basics of the Endnote bibliography and refererence manager program 2013 Attila Skulteti
1 PROGRAMMING IN HASKELL An Introduction Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
Introduction to the NetBeans Platform Certified Training Course Geertjan Wielenga Sun Microsystems.
Haskell.
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
EXP file structure.
Presentation transcript:

Uniform Boilerplate and List Processing Or: Scrap Your Scary Types Neil Mitchell and Colin Runciman, Haskell Workshop, 2007 Simple generics (Haskell ’98)

Hutton’s Razor++ data Exp = Lit Int | Neg Exp | Add Exp Exp | Sub Exp Exp | Mul Exp Exp | Div Exp Exp What literals are in an expression? Change all Sub to Add/Neg?

Literals in an expression literals (Lit i ) = [i] literals (Neg x ) = literals x literals (Add x y) = literals x ++ literals y literals (Sub x y) = literals x ++ literals y literals (Mul x y) = literals x ++ literals y literals (Div x y) = literals x ++ literals y

Uniplate in action What literals are in an expression? Change all Sub to Add/Neg? literals x = [i | Lit i <- universe x] removeSub = transform f where f (Sub x y) = Add x (Neg y) f x = x * Was called “Play” before Colin renamed it

Simplicity of Haskell ‘98 class Uniplate a where uniplate :: a -> ([a], [a] -> a) universe :: Uniplate a => a -> [a] transform :: Uniplate a => (a -> a) -> a -> a class Data a where gfoldl :: (forall d b. Data d => c (d -> b) -> c b) -> (forall g. g -> c g) -> a -> c a Compared to Scrap Your Boilerplate (SYB):

Uniplate Geniplate Lenses reformulated performance ML “Traversal” refactored Curry ported Multiplate used ported restricted Semiplate

Applications (48 on Hackage) HLint – Haskell linting tool Reduceron – FPGA compiler Supero – Haskell optimiser Hoogle – Haskell search engine NSIS – Windows installer generator Scion – IDE backend Tamarin prover – Security theorem prover Codo notation – Comonad notation Yi – text editor …

Retrieving re-usable software components by polymorphic type Colin Runciman and Ian Toyn, JFP, 1991 Let’s define a type-based search engine! Mikael Rittri, Using Types as Search Keys in Function Libraries. FPCA 1989

... recent developments in so-called hypertext systems...

Hoogλe (2003-), (2007-) Web based, Haskell servers Name and type-based search Search 8,457 functions – vs 203 in 1991 Many company-local copies – Instant reports if it goes down! Integrated in FP Complete IDE – People were paid to work on it

What should match? In what order? Not too slow… (a -> a -> a) -> [a] -> a Hoogλe

(a -> a -> a) -> [a] -> afoldl1, foldr1 (a -> a -> a) -> [a] -> [a] scanl1, scanr1 Foldable t => (a -> a -> a) -> t a -> a foldl1, foldr1 (a -> a -> Ordering) -> [a] -> a minimumBy (a -> b -> a) -> a -> [b] -> afoldl (a -> b -> b) -> b -> [a] -> bfoldr (a -> a -> Bool) -> [a] -> [a]nubBy (a -> a -> a) -> [a] -> a Hoogλe

Hoogλe Usage I would love to update this, but the log file is now 8.4Gb ~30 million searches since 2009

Funny Searches Colin Runciman :: Colin Runciman eastenders california public schools portable classes diem chuan truong dai hoc su pham ha noi 2008 ebay consistency version videos pornos gratis Gia savores de BARILOCHE name of Peanuts cartoon bird