Haskell

Haskell 17: Command: t (Data Types)

20 videos

111 minutes

Hello world give them the such are welcome to this course of haskell where we will see a very useful command that has to do with the data type, This command will not only be used to see what value is a simple but very powerful is something we can even transcend functions or more advance things, I show you how it is, is command is: t and then you put the value you want to know your type,

for example if I put: t and a letter telling me is that char is a character, if I put: t and put a chain, for example I put 'hello' He tells me that here I have a list of characters, as I also said in a, a list of characters here is a list of a single character while the chains we have seen that haskell considers as lists of characters, here is a list of a character

and here is a list of four characters, if I put: t and put a true tells me is a boolean true, if I put: t and put a number, eg 6, He tells me that 6 is a number, if I put a 6.8 tells me that is a fractional, bone and is different because we are talking about values ​​that are not integers, good but this so far is simple with these easy examples, but I can tell something using the format: t,

for example we have seen that for lists if I want to know what the first element of a list I use the head function, so if I have the list here and I have different values, now when I make a list head I returned the first, good and that guy has this head function, it is as simple as if I put: t head returns me the format of this function,

He tells me that I get a list and returns the first realize? I can also do with another feature we've seen more recently like the pairs, if I put: t fst. remember that the format I passing a pair back at me the first of the two values, the first of the first, here tells me the format receives a pair and that pair where 'a' and 'b' are the values ​​I returned to the first, if I put the second format

tells me upside down, tells me that I get a pair and returns the last, well this I can apply to any advanced feature that I have, I knew the format and what brings me back, which is the type of that function so it's important to know functions indicate that guy is, because it is also a good practice, a good thing and only as a fact that if I put a Boolean expression here, for example put 4 == 5

which brings me back is that what is being done is a Boolean expression, well this has been the video of this time here, the command: t, more advanced topic we will see that it is very useful and can help a lot, I hope you enjoyed the video, you can give the like, share, subscribe, see more tutorials, greetings!

To find new courses, subscribe. There will be no spam, promised :)

About the Author

foto de jotajotavm
José Javier Villena

Biography: Analyst-Programmer in different languages. Tutor PREMIUM platforms recognized worldwide as CodigoFacilito. Editor Cristalab articles. My YouTube Channel is sponsored by the ANAYA and LaTostadora publisher. I like to explain in detail and give several examples for the avoidance of doubt.