purescript-datetime icon indicating copy to clipboard operation
purescript-datetime copied to clipboard

Example usage missing in docs

Open osfameron opened this issue 4 years ago • 2 comments

Even a single example of how to construct the main data type in a module would be really helpful. For example in Data.Time, you need a lot of understanding and experience to figure out that you're supposed to do something like:

import Data.Enum (toEnum)
myTime2 :: Maybe Time
myTime2 = Time <$> toEnum 11 <*> toEnum 30 <*> toEnum 59 <*> toEnum 213 

I didn't have that experience... (Helpful people on #purescript-beginners Slack suggested the above.) Would you consider adding that kind of example to the docs?

osfameron avatar Jun 28 '20 09:06 osfameron

All of our libraries should have guides (along with better examples). Here are some of my favorites that set a bar to strive for:

  • https://github.com/purescript-contrib/purescript-argonaut-codecs/blob/main/docs/README.md
  • https://github.com/purescript-halogen/purescript-halogen/tree/master/docs

There's some discussion on a strategy for getting this done across the ecosystem, so we'll try to tackle that here too.

Here's a recent guide written by @dariooddenino https://codingstruggles.com/ps-dates/ Though it would be best for discoverability for guides to incorporated into each library's repo.

milesfrain avatar Aug 26 '20 20:08 milesfrain

Yes, I agree that they would be better if incorporated in the repo. Right now it's there because it was the easiest way for me to have something online and get feedback while I work on it. My dream is still an upgraded version of pursuit that allows for users contributed examples and guides

dariooddenino avatar Aug 27 '20 08:08 dariooddenino