concept precede lesson in category haskell

appears as: preceding lesson, preceding lessons, The preceding lesson
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

In the preceding lesson, you learned how to pass in programming logic to other functions because of first-class functions. For example, you might have a get-Price function that takes a URL and a website-specific price-extraction function:

In the preceding lesson, you learned how to use the <*> (pronounced app) operator to extend the power of Functor’s <$> (pronounced fmap) operator. In this lesson, you’ll take a closer look at the Applicative type class. You’ll explore the difference between types that represent a container and types that represent a context. You’ll finish by looking at the powerful things you can achieve by using lists as a context.

In the preceding lesson, we showed how a User could be created in different contexts by using Applicative. You used this User type for a user in a video game:

Listing 35.3. Rewriting Palindrome from the preceding lesson to work with Text
{-# LANGUAGE OverloadedStrings #-} module Lib ( isPalindrome ) where import qualified Data.Text as T import Data.Char (toLower,isSpace,isPunctuation) stripWhiteSpace :: T.Text -> T.Text stripWhiteSpace text = T.filter (not . isSpace) text stripPunctuation :: T.Text -> T.Text stripPunctuation text = T.filter (not . isPunctuation) text preProcess :: T.Text -> T.Text preProcess = stripWhiteSpace . stripPunctuation . T.toLower isPalindrome :: T.Text -> Bool isPalindrome text = cleanText == T.reverse cleanText where cleanText = preProcess text