DEV Community

loading...

Discussion on: July 3rd, 2020: What did you learn this week?

Collapse
vonheikemen profile image
Heiker

I continue my journey into the "functional side" of javascript. I've been playing around with sanctuary, which is like a hardcore version of ramda (which in turn is the functional version of lodash). It's been interesting and weird, you get this cool utility functions but you also get error messages like this.

 error: Uncaught TypeError: Type-variable constraint violation

 insert :: String -> a -> StrMap a -> StrMap a
                     ^           ^
                     1           2

 1)  true :: Boolean

 2)  "Incorrect" :: String

 Since there is no type of which all the above values are members, the type-variable constraint has been violated.

I guess this is good if you know haskell (that type signature is a haskell thing for sure), but it takes time to get used to if you don't.

I made a little guessing game with it. Click on a hex color and an alert pops.