4 ms·
Haskell libraries and programmers are good about using type synonyms to avoid this problem. Notice http://hackage.haskell.org/package/happstack-server-7.3.2/do
by coolsunglasses 13y ago
Haskell libraries and programmers are good about using type synonyms to avoid this problem.
Notice http://hackage.haskell.org/package/happstack-server-7.3.2/docs/Happstack-Server-Types.html#t:Method http://hackage.haskell.org/package/happstack-server-7.3.2/do... isn't a string like "GET" or "POST".
- jrockway 13y agoYes. newtype and GeneralizedNewtypeDeriving eliminates pretty much every excuse for not writing type-safe code.
- coolsunglasses 13y agoGeneralizedNewtypeDeriving is kinda terrifying though, you're better off dumping the derivations from GHC and inserting them yourself after having a look-over :) -ddump-* is great for this kind of thing.
- jrockway 13y agoWhat, autogenerated code never has strange bugs! :) That said, it works well enough for deriving monad from a transformer stack. Do people use monad transformer stacks? It's been a while since I've written any real Haskell code.
- coolsunglasses 13y agoMonad transformers and stacks of them are pretty standard though it's something library writers engage with more often than "users". There are more adventurous and specific ways being explored to handle things like "effects", but that exists mostly in SHE or Idris. mtl is still the practical way to go for now. I keep wanting an excuse to futz around with this: http://hackage.haskell.org/package/layers http://hackage.haskell.org/package/layers
- coolsunglasses 13y agoIt should also be noted that my specific example doesn't even use or need newtype. It's a sum type that derives a bunch of standard typeclasses.