Top Tweets for #PatternGuards
@maksbotan @_gilmi I am team #PatternGuards for this reason, minimal indentation, branching, let declaration, pattern matching that can introduce local constraints
foo :: forall a. Typeable a => a
foo
| App f _ <- TypeRep @a
, Just HRefl <- eqTypeRep (TypeRep @[]) f
= []
I wrote a code on Github with legacy code designs, revisited with FP in @java 14 :
(@GroupBees1 demo)
#validator
#decorator
#patternGuards
#factory
For all the classes, i show the legacy code and the refacto with FP.
#java14 #record #FP
https://t.co/CepJvXWbAP
@josecalderon @tomaspetricek In Haskell, with the former I can also introduce #PatternGuards for let bindings, guards or bring local constraints into scope
I work on my first project with @scala_lang and i admit that is a great programming language
#FP #Monad #Option #Try #Either #Tuple #PatternMatching #PatternGuards #CaseClasses ....
when I'm writing
map (\a -> ..)
& need guards (also useful for bringing constraints into local scope!) I don't think to write
map (\case a | .. -> ..)
because I'm not case-ing on 'a', I just hijack its #PatternGuards. Would I actually prefer
map (\a | .. -> ..)
who knows

@emi1ypi @whyevernotso It's the #PatternGuards syntax
foo a
| a < 0
= ..
| otherwise
= ..
which allows let bindings ('| let' is incidentally a drop in replacement for '| otherwise'), all of these let binding are accepts:

Trends for you
Most Popular Users

Elon Musk 
@elonmusk
240.2M followers

Barack Obama 
@barackobama
119.3M followers

Donald J. Trump 
@realdonaldtrump
111.6M followers

Cristiano Ronaldo 
@cristiano
108.9M followers

Narendra Modi 
@narendramodi
107M followers

Rihanna 
@rihanna
97.3M followers

NASA 
@nasa
92.1M followers

Justin Bieber 
@justinbieber
90.6M followers

KATY PERRY 
@katyperry
86.8M followers

Taylor Swift 
@taylorswift13
80.6M followers

Lady Gaga 
@ladygaga
72.2M followers

Kim Kardashian 
@kimkardashian
69.4M followers

YouTube 
@youtube
68.6M followers

Virat Kohli 
@imvkohli
68.5M followers

Bill Gates 
@billgates
63.4M followers

The Ellen Show
@theellenshow
62.5M followers

CNN 
@cnn
61.9M followers

Neymar Jr 
@neymarjr
61.1M followers

X 
@x
60.9M followers

Selena Gomez 
@selenagomez
59.9M followers




