Giter Site home page Giter Site logo

Comments (4)

klappvisor avatar klappvisor commented on June 3, 2024

@fizruk Unfortunatelly there is an optional title in the other constructors, so it's done this way as common denominator

from haskell-telegram-api.

klappvisor avatar klappvisor commented on June 3, 2024

@fizruk But if you can suggest better option, I would be happy to implement it

from haskell-telegram-api.

fizruk avatar fizruk commented on June 3, 2024

@klappvisor I'm currently experimenting with Telegram Bot API using this library. This was the first thing I noticed. However it is a very minor thing.

Recently I noticed that Telegram Bot API simulates sum types:

At most one of the optional parameters can be present in any given update.

This object represents one button of an inline keyboard. You must use exactly one of the optional fields.

Exactly one of the fields data or game_short_name will be present.

telegram-api currently copies data type design and does not leverage sum types for these objects.
And it makes handling updates somewhat painful (without pattern synonyms or lenses) and also allows for invalid data to be constructed (which could be avoided easily with sum types).

In any case, I'm still trying things out and I may have more concrete suggestions later :)

from haskell-telegram-api.

klappvisor avatar klappvisor commented on June 3, 2024

@fizruk Thank you for your feedback! It's actually very relevant, you are right, but it would require major breaking change. I guess it's better to do it anyway, hopefully together with the others I could find, to avoid constantly breaking API.

As user, what do you think about current order of the arguments in runClient?
Currently:

runClient queries token manager

Or

runClient token manager queries

That will make it possible to write

runClient toekn manager $ do
  me<- getMeM
  webhook <- getWebhookInfoM

Any other suggestions are welcome

from haskell-telegram-api.

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.