Code Monkey home page Code Monkey logo

Comments (4)

egonSchiele avatar egonSchiele commented on May 11, 2024

The problem with this approach is it will require type signatures for routes. Since we're using OverloadedStrings, there would be no way for Haskell to know how to interpret this:

get "/hello"

It requires writing this instead:

get ("/hello" :: Text)

...yuck.

So as I see it there are a few options:

  • Introduce general functions like fget, fpost etc that behave like specified above, and leave the existing get, post etc functions alone. So fget is to get as fmap is to map.

  • Introduce a new function getr that works for regexes only:

    getr :: Regex -> ActionM () -> ScottyM()

Which I don't like as much because it feels like we don't get as much for crowding the namespace.

If we decide to go with either of those approaches, we'll have to choose a regex library to add as a dependency. I wish Haskell had a standard regex library :P

The final option is to ignore regexes and just support wildcards *. Thoughts?

from scotty.

sordina avatar sordina commented on May 11, 2024

Hi Aditya.

I've implemented a Regex routes using a new datatype. Have a look and see if you like it. I've sent a pull request, but it would be good to get someone else to have a look.

from scotty.

egonSchiele avatar egonSchiele commented on May 11, 2024

See my comments inline. Looks great, I'd like to get this merged in!

from scotty.

egonSchiele avatar egonSchiele commented on May 11, 2024

Added in commit f5a99eb. Closing.

from scotty.

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.