5 ms·
Generalized Algebraic Data Types: A Primer
- blograbbit 7y agoTry this see how good it works though. https://www.onmoneygrounds.com/credit-karma-login-credit-karma-report-how-to-create-your-account/ https://www.onmoneygrounds.com/credit-karma-login-credit-kar...
- sushisource 7y agoLink just renders an empty page? On firefox, at least.
- cryptonector 7y agoAre you using NoScript? You have to enable scripts.
- minieggs 7y agoLooks like a graphql endpoint fails. 500 "invalid hook" ? After 10ish refreshes it worked... Qutebrowser here.
- NikkiA 7y agoIt does the same in chromium, so at least it's not a 'there's only one browser I develop for' situation...
- monkpit 7y agoIf I try to scroll down on iPhone, it shows that a 500 error was hidden behind the nav/header.
- andywhite37 7y agoIt's probably a free-tier heroku app, being hugged to death right now. I've used this site quite a bit in the past on FireFox, Chrome, and Brave, and it has worked perfectly before.
- thangngoc89 7y agoThank you. Like you said, I use Firefox for development and test it on Chrome as well. The target users of Sketch.sh is web developers so I received bug reports about browser incompatibility almost instantly. It was a problem with now.sh version 1 platform. I can't find a way to scale the free v1 node. All their docs prefer to upgrading to version 2 platform.
- thangngoc89 7y agoHello, I'm the main developer of Sketch.sh and there seems to be a problem with the authentication server right now. I'm working on resolving it.
- onemoresoop 7y agoHurry up, you're prime time on HN now!
- thangngoc89 7y agoUpdate: apparently I'm being rate limited. https://auth.sketch.sh/api/auth/webhook https://auth.sketch.sh/api/auth/webhook Another kind of HN hug of death
- kornish 7y agoHmm, is that a Zeit thing or a Sketch.sh thing? Seems pretty worrying if a service hosted on Zeit can't deal with HN frontpage-level load.
- thangngoc89 7y agoUpdate: It's (partially) working again now. You all can view the Sketch. Apology for the inconvenient.
- deleted 7y ago[deleted]
- bokumo 7y agoSince there is no explanatory text, this seems to be more of a testing environment than a primer.
- deleted 7y ago[deleted]
- andywhite37 7y agoTry looking again - maybe you caught a version that didn't render correctly. There is actually quite a bit of explanatory text, and it's quite good!
- bokumo 7y agoThank you, you are correct.
- hardwaresofton 7y agoI find the GADT syntax used in the article hard to follow... Normally this is what I see, straight out of Jannis Limperg's insanely helpful compilation of language extension examples[0]: data RestrictedMaybe a where JustInt :: Int -> RestrictedMaybe Int JustString :: String -> RestrictedMaybe String Nothing :: RestrictedMaybe a Maybe the intention was more of a "from scratch" implementation (without using extensions) but the above syntax is a bit easier to follow in my opinion IMO. It might also be a good idea to make note of where the polymorphism is happening (the "a") and note how it's ok that the a is "resolved" in some of these constructors but not in the others. [0]: https://limperg.de/ghc-extensions/#gadts https://limperg.de/ghc-extensions/#gadts
- anuragsoni 7y agoFWIW OCaml (the linked example is using reason, a different syntax for OCaml) doesn't need a syntax extension for GADTs. On a similar note i find the OCaml syntax easier to read than Reason's. (There is an option to toggle between the two in the linked website) The example from your post in OCaml: type 'a restricted_maybe = | JustInt : int -> int restricted_maybe | JustString : string -> string restricted_maybe | Nothing : 'a restricted_maybe
- acchow 7y agoThat’s essentially the same but with the type parameter appearing before the type name.
- molyss 7y agoOn my iphone, I can’t jump to the links, and if I try to select a URL, it switches to edit mode and I can’t even switch tabs because the keyboard is constantly taking over. I was interested by the title but will skip the article because of poor UI
- bo1024 7y agoI get nothing useful onscreen at all
- shrthnd 7y agowtf is sketch.sh and why is it so awesome? really though, this is a comfortable experience and the seamless live-coding environment feels natural. nice work!
- skybrian 7y agoThis is interesting, but several of the examples are useless (such as HList) or might not be a good idea in practice. Sometimes that's an easier way to explain a concept, but it would be helpful to see more examples that show you techniques that are actually recommended, rather than what not to do.
- antisemiotic 7y ago>several of the examples are useless (such as HList) I tried to use a similar (though more streamlined) Vinyl [1] for implementing database querying that glued and sliced records to match the queries, but alas, GHC choked and died on the type-level list operations. That was several years ago though and I didn't touch Haskell since then, maybe something has changed. [1] https://hackage.haskell.org/package/vinyl https://hackage.haskell.org/package/vinyl
- whateveracct 7y agoHLists actually aren't _useless_ in practice. I know I've used shapeless to do some datatype-generic programming with them (deriving CSV rows from a case class without reflection.) Heterogenous unions are very similar and also extremely useful (multiple effects libraries build on top of them).
- dan-robertson 7y agoWell HList gives you something which behaves like a tuple with generic size. The difference between an HList and a type like (a * (b * (c * unit))) is that the HList can use the regular list syntax which is much nicer to match on (especially with type constructor disambiguation). Eg one could imagine a varadic list map function which behaves a bit like map in lisps (ie accepting any positive number of lists). Although this would need multiple types that look like lists because of the lack of higher kinded types in reason/ocaml
- mrvicadai 7y agoCan't wait for the DSL portion of the write up -- keep up the nice work!
- penguin_booze 7y agoIs is the latest trend to render markdown verbatim? Another recent post on HN: https://news.ycombinator.com/item?id=20211778 https://news.ycombinator.com/item?id=20211778
- spraak 7y agoZeit.co does this too. I think it's weird
- enriquto 7y agoIt is much more readable, especially in notebooks where "rendering" the markdown reflows the text and you get lost.
- quickthrower2 7y agoThis is forgivable because you can fork and edit it. Once you go from reading to editing, it is useful to see the markup. Many of us are used to reading verbatim markdown if your team uses readme.md in the git repo root of projects.