Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not directly related to this cheatsheet, but I was reminded by the section on operators: you can combine multiple binary operators to get something a lot like ternary operators. E.g., in ghci:

  Prelude GOA> let True ? x = \_ -> x ; False ? _ = \f -> f
  Prelude GOA> True ? 4 $ 5
  4
  Prelude GOA> False ? 4 $ 5
  5
  Prelude GOA> False ? 4 $ True ? 3 $ 7
  3
  Prelude GOA> False ? 4 $ False ? 3 $ 7
  7
Pretty neat, I think.


Wow, GOA, that's a flashback. 2004??


Is it now the mark of the n00b, or something? Or just your own involvement is old?


FTR, I started playing with Haskell early 2012 and I have no idea what GOA is. All I ever see at my prompt is ghci.

If this is what GOA is, it actually sounds incredibly useful: http://www.haskell.org/haskellwiki/GHC/GHCi#GHCi_on_Acid. Looking up docs/source for modules? Enumerating typeclass instances? Yes please.


I'd forgotten about GOA -- it was a little toy project I came up with to embed lambdabot in GHCi. Looks like it was revived, moved to github, and growing happily. Major flashbacks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: