It's hard to write interesting programs with just simple types such as strings and numbers. In this video, you'll look at built-in data structures such as lists and tuples, and see how you might do a simple dictionary lookup using built-in functions and the Maybe type.
- [Narrator] In this video, we're going to explore Haskell's…built-in data structures.…First of all, we'll look at lists,…perhaps the most important data structure in Haskell…and a key one for beginning to think in a functional way.…We will also look at tuples and a simple dictionary…using the lookup function.…Finally, we will have a quick look at the maybe data type…for expressing possible data.…As we saw in the last video, strings are in fact modeled…as lists of char, or characters.…
And, this string could have been written in list notation.…Similarly, we can write lists of numbers.…And these, for example, have a…type of num.…We could do the same with floating-point…or fractional numbers.…Haskell has many functions to deal with lists.…Lets look at some simple ones.…We've already done the example of taking the length…of a string, and of course, we can do the same…with a list of numbers.…
Haskell also has a range feature,…which we can use on data like numbers.…But, how does Haskell define an array?…If we took the type of a string,…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Discovering Haskell with GHCI
- Haskell datatypes and functions
- Using higher order functions for data manipulation and code reuse
- Editing Haskell source code
- Creating a project with Stack
- Writing and conducting tests