Comments (3)
Now that I think about it. Returning Either[String, ...]
doesn't make that much sense. There is no good feedback loop in the form. It would only be able to return the error when submitting the form, so it is no different than verifying the input in the function implementation. Unless of course, we compile the type classes separately to js functions using Scala.js and attach them to the generated site. I don't have any good ideas on how to do that though. (Other than running scala-cli during site generation, which seems like a HUGE hack)
from guinep.
A decent idea is to define a decoder as
trait Decoder[-I, O]:
def decide(I: I): O
Then we can summon Decoder[Nothing, T]
in the macro generated code. (If we can manage to get that to work) Or maybe we can make I
a type member instead.
Then based on the I
we can figure out the field type, probably.
Not sure how to handle dropdowns with this encoding though. Maybe the I
type should only ever be an internal InputType
? Or maybe just add a field to the type class that defines the input field type?
e.g.
trait Decoder[O]:
type I <: InputType
def decide(I: InType[I]): O
(This might have to be on the term level)
from guinep.
One implementation detail for implementing this is that the generated code should change the eithers into exceptions, apply the function to the arguments extracted from the eithers and optionally catch the exceptions.
from guinep.
Related Issues (20)
- Add tests
- Fix the web form to display the result on the same page
- Cleanup the endpoints
- Support sum types (sealed hierarchies)
- Support tuples in addition to functions
- Support generics
- Add docstrings to exposed functions HOT 1
- Support recursive structures
- Support undecidable generics HOT 1
- Support multiple parameter lists (and extension methods)
- Support missing primitive types
- Special case collections
- Support nullability
- Fix function ordering in the sidebar
- Add a "user heap"
- More special cased collections
- Support for union types
- Support opaque types
- Progress indicator HOT 1
- Http server config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guinep.