20 videos
111 minutes
Hello world this are, I welcome this new video course Haskell where we will see today as do type conversions, in this case we will see two functions, the show and read function, function show them each and here we see the example, for example if I want to transform anything to use the text string show function, so I can put show 3 show in March, and I returned it as a text string,
if I put show and put a decimal value it as I returned text string and if I put a Boolean value returns me it as a text string, this is the use of the show function, for example if I want to display a list put here one two three returns me the list but as a text string, it is actually a string where the first element is a bracket the second is a number, they are characters but is not listed as such,
and I ceased to be a list and step to be a text string, also if we do here is a tuple such as a 3-tuple the same thing happens, that and stop being a tuple and happened to be a text string, so learn the show function. Let's see another type of converter in this case the read function that allows us to convert to a greater variety of types, while just happens to show text strings can read
make us want, for example we put we want to do and I have here a sum value as a text string six point five but by making the sum going to put a number, eight point one works and read as follows, the first parameter that I pass I'll take it as if it were the type of the second parameter that I'm putting it here, no matter the operator is here,
no matter if it is a longer if less if it is a Boolean, the thing is that the first type I will understand like the second data rate I'm going through it, so I give to enter and makes me sum this string and I read it like a numeric type as the one I was happening here, now going to see if I for example here and say put a false and true,
false and true is false if I intro, hey forgiveness, so if I make a false and true false and true is false but this false I pass as text string; however I transform myself in the second Boolean operator because I was going through was a Boolean, another example for you to see, if I here make a read and passed a text string, you notice that this step is a text string
but within the chain I'll put a list, I put here four, eight, two, four, I make a list and now I want to add to this list one element at the end, we've seen how it's done, put here another element, I put here a nine, I like intro and I take that to this list it is a chain but transformed to list because it is the type of the second value and has added a number, well, this is the power read,
allows us to read any data with the guy we want, as such be the second operator, good in the next video surely we go to see a little more of this type of functions, I hope you liked it, you can give the like, share and subscribe, greetings.
About the Author
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.