38 Matching Annotations
  1. Feb 2021
    1. The IO monad wraps computations in the following context: "This computation can read information from or write information to the terminal, file system, operating system, and/or network". If you want to get user input, print a message to the user, read information from a file, or make a network call, you'll need to do so within the IO Monad. These are "side effects". We cannot perform them from "pure" Haskell code.
  2. Jan 2021
    1. Haskell is the best functional programming language in the world and Neural Networks are functionsThis is the main motivation behind Hasktorch which lets you discover new kinds of Neural Network architectures by combining functional operators

      Haskell is a great solution for neural networks

  3. Aug 2020
    1. Commonly the above definition is called the identity function. But in fact we should think of it as a whole family of functions. We should really say that id is an identity function for all types a. In other words, for every type T you might come up with, there is an identity function called id, which is of type T -> T. This is the type-checker’s view anyway, and by turning on the RankNTypes extension we can be explicit about that in our code: {-# LANGUAGE RankNTypes #-} id :: forall a. a -> a id x = x

      This is such a nice description of forall. It should be combined with forall is the type-level "lambda" (also saved it here).

    2. Now it is much clearer that id is really a family of infinitely many functions. It is fair to say that it is an abstract function (as opposed to a concrete one), because its type abstracts over the type variable a. The common and proper mathematical wording is that the type is universally quantified (or often just quantified) over a.

      This was very neatly put, and forall above is also spot on.

    3. It also adds safety through a property called parametricity. If we pretend that there are no infinite loops or exceptions (it’s okay to do that, so we will do it throughout this article), then the function is actually fully determined by its type. In other words, if we see the type a -> a, we know that the corresponding value must be the identity function.

      If this would be the first time I came across parametricity, I wouldn't understand what it means.


      In programming language theory, parametricity is an abstract uniformity property enjoyed by parametrically polymorphic functions, which captures the intuition that all instances of a polymorphic function act the same way.

      That is, a function with the type signature a -> a has only one implementation: it can only return its input. In a similar fashion, a -> b -> a will only return the first argument and ignore the second. And so on.

    4. In other words you cannot choose the definition of a value based on its type (for now).

      What does this mean?

  4. Jul 2020
  5. May 2020
    1. function (or in the case of type classes, we call these methods)
    2. If you can tell that two types are equal or not equal, that type belongs in the Eq type class.

      two types or rather two things of the same type?

    1. Programming languages These will probably expose my ignorance pretty nicely.

      When to use different programming languages (advice from an Amazon employee):

      • Java - enterprise applications
      • C# - Microsoft's spin on Java (useful in the Microsoft's ecosystem)
      • Ruby - when speed is more important then legibility or debugging
      • Python - same as Ruby but also for ML/AI (don't forget to use type hinting to make life a little saner)
      • Go/Rust - fresh web service where latency and performance were more important than community/library support
      • Haskell/Erlang - for very elegant/mathematical functional approach without a lot of business logic
      • Clojure - in situation when you love Lisp (?)
      • Kotlin/Scala - languages compiling to JVM bytecode (preferable over Clojure). Kotlin works with Java and has great IntelliJ support
      • C - classes of applications (operating systems, language design, low-level programming and hardware)
      • C++ - robotics, video games and high frequency trading where the performance gains from no garbage collection make it preferable to Java
      • PHP/Hack - testing server changes without rebuilding. PHP is banned at Amazon due to security reasons, but its successor, Hack, runs a lot of Facebook and Slack's backends
  6. Apr 2020
  7. Mar 2020
  8. Feb 2020
    1. Nix is a purely functional package manager. This means that it treats packages like values in purely functional programming languages such as Haskell — they are built by functions that don’t have side-effects, and they never change after they have been built.
  9. Nov 2019
    1. haskell-overridez is a tool and library of nix functions that simplify the use of overrides while developing haskell projects with nixpkgs.

  10. Jun 2019
    1. This package takes a more declarative approach, and talks about events rather than signals. Widgets emit event values, and these values can be mapped and transformed into other values as the event propagates up the tree of widgets.

      So this is a bit more elm-y than it would otherwise be

  11. Apr 2019
  12. Mar 2019
  13. 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]
  14. Jan 2019
  15. Oct 2018
  16. Sep 2018
  17. 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.

  18. 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
  19. Oct 2017
  20. Apr 2017
  21. Dec 2016
  22. Oct 2016
  23. Jul 2016
    1. Saw this recommended on a Quora answer whilst looking for book and article recommendations for a newcomer to Haskell

  24. Jun 2016
  25. May 2016
  26. 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.