¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Introduce el texto aquí

CASTILLO ZAMBRANO LUIS FELIPE Español

Contenido del mapa

Introduce el texto aquí

  1. INTRODUCTION TO THE TYPES OF ALGERATIC DATA.

    • Data -> to define a type
      • data Shape = Circle Float Float Float | Rectangle Float Float Float Float deriving (Show)
  2. Registration syntax

    • data Person = Person { firstName :: String , lastName :: String , age :: Int , height :: Float , phoneNumber :: String , flavor :: String } deriving (Show)
  3. Parameters of type

    • A data constructor can take some values as parameters and produce a new value.
      • data Maybe a = Nothing | Just a
  4. Derivative instances

    • a class of types is a kind of interface that defines a behavior.
    • Haskell can derive the behavior of our types
      • Using the word Deriving when we defined it, we would achieve this
        • data Person = Person { firstName :: String , lastName :: String , age :: Int } data Person = Person { firstName :: String , lastName :: String , age :: Int } deriving (Eq)
      • By deriving the show class, the person can be shown on the screen because this method converts the data type to a string
        • With the Read function the reverse process could be done.
    • • Eq, Ord, Enum, Bounded, Show y Read
      • The Enum class are for things that have a predecessor and successor
  5. Synonyms of type

    • The synonyms of type do not do anything by themselves, they just give some kind a different name, so that it gets some meaning for someone who is reading our code or documentation.
      • type String = [Char]
      • Give a synonym to the String type is something that is usually when they want to convey some more information about the purpose of the chains in their functions and what they represent.
      • When we are interested in how or why something has failed, we usually use the type Either a b as a result, where a is some kind of type that can tell us something about a possible failure, and b is the type of a satisfactory calculation
  6. Recursive data structures

    • We can define functions that are automatically infixed if we name them only with special characters.
      • infixr 5 :-: data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord)
  7. Type classes step by step (2nd part)

    • When we say that a type is an instance of a type class, we are saying that we can use the functions of that type class with that type.
    • The type class Yes-No
      • instance YesNo Int where yesno 0 = False yesno _ = True
  8. The kind of functor types

    • The Functor type class is basically for things that can be mapped.
    • The list type is a member of the Functor type class.
    • F would be a type constructor and not a type
      • class Functor f where fmap :: (a -> b) -> f a -> f b

Información

Descripción
Mapa Mental sobre Introduce el texto aquí, creado por CASTILLO ZAMBRANO LUIS FELIPE el 19/03/2018.
Visitas
2
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?