19 Matching Annotations
  1. Apr 2019
  2. Mar 2019
  3. Feb 2019
    1. Haskell

      Haskell, Keep it simple, stupid.

      -- FizzBuzz
      module Main where
      
      import Control.Monad
      
      main :: IO ()
      main = forM_ [1..100] $ \n -> putStrLn . concat . take 2 $
          ["Fizz" | n `mod` 3 == 0] ++ 
          ["Buzz" | n `mod` 5 == 0] ++ 
          ["", show n]
      
  4. Jan 2019
  5. Oct 2018
  6. Sep 2018
  7. Apr 2018
    1. (== 10)

      This confused me. I'm relatively new to Haskell and did not know about sectioning. After learning that detail, this makes sense as a (right) partial application of the (==) function.

  8. Jan 2018
    1. Whereas normal type classes represent predicates on types (each type is either an instance of a type class or it isn’t), multi-parameter type classes represent relations on types
  9. Oct 2017
  10. Apr 2017
  11. Dec 2016
  12. Oct 2016
  13. Jul 2016
    1. Saw this recommended on a Quora answer whilst looking for book and article recommendations for a newcomer to Haskell

  14. Jun 2016
  15. May 2016
  16. Oct 2014
    1. foldMap :: Monoid m -> (a -> m) -> t a -> m

      I'm not sure, but I think what he meant here was foldMap :: Monoid m => (a -> m) -> t a -> m.

    2. The notion behind it was that one could decompose, e.g., Applicative into an instance of the Pointed typeclass and an instance of the Apply typeclass (giving apply :: f (a -> b) -> f a -> f b) and an instance of Pointed, such that the two interact properly.

      There's more on Applicative (and Functor) here, in case you're unfamiliar with it.