GithubHelp home page GithubHelp logo

Comments (6)

safareli avatar safareli commented on July 23, 2024 2

Would you like to submit this as a PR?

Yes!

from purescript-spec.

felixSchl avatar felixSchl commented on July 23, 2024

I would welcome utility functions like these as I have been re-inventing that wheel many times over for neodoc

from purescript-spec.

mostalive avatar mostalive commented on July 23, 2024

from purescript-spec.

owickstrom avatar owickstrom commented on July 23, 2024

Yeah, this does seem useful. I have some questions/considerations:

  • The name forAll feels like it's too close to forall. Would prefer something closer to it, as it's basically a "multi-it". Perhaps they?
  • I'd prefer to drop the outer describe in this definition, keeping it a bit simpler, and not making an assumption that you want a separate level for the foldable. I'm not sure, but you might want to do something like:
    describe "many things" do
      they show [2, 4] \n -> (n `mod` 2) `shouldEqual` 0
      they show [4, 8] \n -> (n `mod` 4) `shouldEqual` 0
  • And as a last thing, is the argument order the way we want? Not saying it isn't, but you might have feedback on that.

Thanks for the suggestion!

from purescript-spec.

safareli avatar safareli commented on July 23, 2024
  • dropping out describe is good idea.
  • they seems good to me.

so at this point it looks like:

they ::  e a f. Foldable f => (a -> String) -> f a -> (a -> Aff e Unit) -> Aff e Unit
they itTitle arb f = for_ arb \a -> it (itTitle a) (f a)

...
  describe "format (unformat a) = a" do
    they show arb \(str) -> (format $ unformat str) `shouldEqual` (Right str) 
...

About order:

I don't have strong opinion on it, but If we leave f as last argument, then we have two options:

  • NAME itTitle arb f, infix usage: itTitle `NAME` arb f
  • NAME arb itTitle f, infix usage: arb `NAME` itTitle f
    I can't think of a good name (english is not my native language) but there might be some name which will best fit this usage. maybe that? (show `that` validDates parseAndUnparseComutes)

from purescript-spec.

owickstrom avatar owickstrom commented on July 23, 2024

Yeah, I could not come with any specific order either, as it doesn't read naturally anyway. I think we should go with what you already have:

they ::  e a f. Foldable f => (a -> String) -> f a -> (a -> Aff e Unit) -> Aff e Unit

Would you like to submit this as a PR?

from purescript-spec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.