1 / 7

Functional Programming at Work: Haskell and Domain-specific Languages

Understand the implementation style, infrastructure, sample code, and type signatures in Haskell for domain-specific languages. Enhance your skills in functional programming. Explore parser combinator libraries like parsec for code organization. Learn about functors, applicatives, and pretty printing.

strom
Télécharger la présentation

Functional Programming at Work: Haskell and Domain-specific Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 600.429FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University

  2. Project Pitch A detailed project pitch will be due next Wednesday. I’ll need to know: • Style of implementation • Infrastructure • Sample code • If embedded in Haskell, type signatures • Implementation plan

  3. Homework Any questions? The next homework will expand on the current one. What is the overall organization of the code? How do you glue together parser

  4. Inside parsec See http://hackage.haskell.org/package/parsec Let’s look at “Char”, “Combinator”, and “Prim” How can we make combinators similar to those in Char with an arbitrary token stream type?

  5. Functor fmap :: Functor f => (a -> b) -> (f a -> f b) (<$>) = fmap fmap f m = do r <- m return (f r)

  6. Applicative f <*> g = do f1 <- f g1 <- g return $ f1 g1 f <* g = do r <- f g return r

  7. Pretty Printing See http://hackage.haskell.org/packages/archive/pretty/1.1.1.0/doc/html/Text-PrettyPrint.html

More Related