Top Tweets for #PatternSynonyms
#PatternSynonyms: Is there a way to define a pattern that when given a type application only matches a TypeRep of that type?
f :: TypeRep a -> a
f (Is @Int) = 10
f (Is @[] `App` Is @Int) = [1,2,3,4]
![Iceland_jack's tweet photo. #PatternSynonyms: Is there a way to define a pattern that when given a type application only matches a TypeRep of that type?
f :: TypeRep a -> a
f (Is @Int) = 10
f (Is @[] `App` Is @Int) = [1,2,3,4] https://t.co/KoEpP3edkb](https://pbs.twimg.com/media/E1W6CjSWEAIMWcA.jpg)
@ijks_w So for lenses, we have 'is' and 'isn'\''t' operators but I agree that there are many places in Haskell where patterns feel, how to say, not just not first-class but underdeveloped or unintegrated into the rest of the language. #PatternSynonyms was a big step forward but

@DaTwinkDaddy I'm susprised how long #PatternSynonyms took, we haven't "solved" coverage at all and it feels like people are oddly disinterested. There are several low-hanging fruits
1. Was GHC first to introduce deriving clauses?
2. Why has adoption taken so long? Rust, PureScript both have them, now Scala, but what other?
3. Lack of type classes?
4. I have a similar question about patterns and #PatternSynonyms!

@_osa1 Yes and patterns have always got second-class attention in Haskell given how late #PatternSynonyms appeared (before, abstracting patterns was impossible) in its history with a lousy story for complete patterns; can't be parameterised ..
A little less next time #PatternSynonyms

How realistically can we make Data.Functor.{Sum,Product} f g a into newtypes over (f a, g a) and (f a `Either` g a) with #PatternSynonyms
pattern Pair as bs = Product__ (as, bs)
pattern InL as = Sum__ (Left as)
pattern InR bs = Sum__ (Right bs)
PatternSynonyms for expressive code by Raghu Kaippully @rkaippully
https://t.co/gA9BaMdqq4
#PatternSynonyms
Bidirectional #PatternSynonyms


#PatternSynonyms sometimes are rather much

Good example to teach #PatternSynonyms
{-# Language PatternSynonyms #-}
pattern LessThan :: Ordering
pattern LessThan = LT
pattern EqualTo :: Ordering
pattern EqualTo = EQ
pattern GreaterThan :: Ordering
pattern GrearerThan = GT
We can give a nickname to lists, to be consistent with other names
type List = []
and now we define #PatternSynonyms for
[] :: List a
(:) :: a -> List a -> List a
![Iceland_jack's tweet photo. We can give a nickname to lists, to be consistent with other names
type List = []
and now we define #PatternSynonyms for
[] :: List a
(:) :: a -> List a -> List a https://t.co/ot5J0w83Ft](https://pbs.twimg.com/media/D0C7i-_WwAA47q8.png)
We can also write #PatternSynonyms for 0
pattern Zero :: (Eq a, Num a) => a
pattern Zero = 0
For pattern synonyms, this is NOT equivalent
pattern Zero :: Eq a => Num a => a


Introduce #PatternSynonyms at the same time as lists.. tell students only to use Nil and Cons for a few decades or something idk
pattern Nil :: List a
pattern Nil = []
pattern Cons :: a -> List a -> List a
pattern Cons a as = a:as
let's go wild #PatternSynonyms
Last Seen Hashtags on Sotwe
bopper
Seen from United States
sleep incest
Seen from Pakistan
ankaratraveſtileri
Seen from Turkey
omegle
Seen from United States
somno #nolimit filter:native_video
Seen from Germany
ㄘㄨˋㄐㄧㄤ
Seen from United States
bursapasif
Seen from Turkey
金小钗
Seen from Indonesia
transgender
Seen from Turkey
นัดเย็ดนนทบุรี
Seen from Thailand
Most Popular Users

Elon Musk 
@elonmusk
240.4M followers

Barack Obama 
@barackobama
119.3M followers

Donald J. Trump 
@realdonaldtrump
111.7M followers

Cristiano Ronaldo 
@cristiano
110.1M followers

Narendra Modi 
@narendramodi
107M followers

Rihanna 
@rihanna
97.5M followers

NASA 
@nasa
92.1M followers

Justin Bieber 
@justinbieber
90.8M followers

KATY PERRY 
@katyperry
87.4M followers

Taylor Swift 
@taylorswift13
81.3M followers

Lady Gaga 
@ladygaga
72.8M followers

Kim Kardashian 
@kimkardashian
69.7M followers

Virat Kohli 
@imvkohli
69.5M followers

YouTube 
@youtube
68.7M followers

Bill Gates 
@billgates
63.7M followers

The Ellen Show
@theellenshow
62.5M followers

Neymar Jr 
@neymarjr
62.2M followers

CNN 
@cnn
61.9M followers

X 
@x
60.8M followers

Selena Gomez 
@selenagomez
60.5M followers







![Iceland_jack's tweet photo. We can give a nickname to lists, to be consistent with other names
type List = []
and now we define #PatternSynonyms for
[] :: List a
(:) :: a -> List a -> List a https://t.co/ot5J0w83Ft](https://pbs.twimg.com/media/D0C7bjkWsAAVjS5.png)
![Iceland_jack's tweet photo. We can give a nickname to lists, to be consistent with other names
type List = []
and now we define #PatternSynonyms for
[] :: List a
(:) :: a -> List a -> List a https://t.co/ot5J0w83Ft](https://pbs.twimg.com/media/D0C7a0jX4AAId24.png)
![Iceland_jack's tweet photo. We can give a nickname to lists, to be consistent with other names
type List = []
and now we define #PatternSynonyms for
[] :: List a
(:) :: a -> List a -> List a https://t.co/ot5J0w83Ft](https://pbs.twimg.com/media/D0C69ESXQAErzGX.png)


