Skip to content
0:00 / 0:00

#haskell#typedholes#ghc

Hole-driven Haskell

Matthew Brecknell

201 subscribers • 1 video on Hallway

YouTube
  • Recommended by 5 people: 5 in engineering communities.
  • Presented by Matthew Brecknell

Intermediate. Assumes working knowledge.

19K views13 years ago5 recommendations

Programming languagesHaskellFunctional programmingTesting

Matthew Brecknell demonstrates how to use Haskell's type system and compiler errors to guide the step-by-step construction of programs.

Demonstration of a technique for using types to guide the construction of Haskell programs, based on natural deduction. Includes some tricks for getting help from GHC.

Why it's here

5 people recommend this

What people say. Recommended as an excellent demonstration of type-driven development and using typed holes in Haskell to write functions.

u/bergmarkin r/haskell • Recommends

On “What are some useful tricks you can do with Haskell that you wish you knew earlier?”

* Replace any type or expression with () and get a easy to read type error that shows what should go in that location (link to this video TypedHoles in GHC 7.8 will make this even better. * Use ghci when developing as much as possible, it's so much quicker. You can import multiple packages with `ghci -ipkga/src -ipkgb/src pkgb/src/Main.hs`. I often have more than 300 modules in a single session this way.

u/talideonin r/haskell • Recommends

On “Coming from PHP, working in Haskell is like programming in a straight jacket”

You might be interested in this: link to this video

u/maninaliftin r/haskell • Recommends

On “Type first coding”

If the OP is looking for videos of the technique he describes, this may be interesting: link to this video

u/swagglerin r/haskell • Recommends

On “How do you reference the name of a class from inside a default implementation of its functions?”

Use Hole Driven Development.

u/protestorin r/haskell • Recommends

On “Best way to learn Haskell?”

Perhaps videos can help? Eg. this on hole-driven development where you learn some interesting technique on how to write a function starting from its type signature. (GHC now has typed holes to facilitate the reverse - you have the expression and want to fill some detail in the type; though he just uses a new type for that)

u/ephrionin r/compsci • Mentions

On “Functional Programming Myths”

> I like FP so much that I've finally decided to learn Haskell, but I think that this is a myth. Computers are dumb and FP can't change that. > Let's say we want to sort a list of integers. Here's the definition of the problem: > * a list is sorted iff ... > * a permutation of a list is ... > * sort list must return a list L such that L is a permutation of list and L is sorted. Haskell's QuickCheck testing/checking library can be used to make these sorts of assertions. It won't actually write the code for you, of course, but it will do a damn good job figuring out how your code doesn't fit if it doesn't. IIRC, QuickCheck is not easily implementable in other languages because of Haskell's…

u/mightybytein r/haskell • Mentions

On “Should I learn haskell?”

There are two main reasons I prefer Haskell to Lisp: 1. Strong, static type system 2. Purity A static type system is invaluable when you're working with unfamiliar code. Without types there is often no hint of what an entity contains. If you want to find out, you often have to hunt through the code looking for something that tells you. With Haskell, it's easy. If the identifier's type isn't already documented with a type signature then it's pretty easy to discover it by using ghci or by using this trick: data Hole = Hole If the code you are working on compiles, then you can replace the identifier in question with `Hole` and the compiler will tell you what the type of your identif…