Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fixes for formStWidget example #2

Merged
merged 1 commit into from
Jun 29, 2019
Merged

Conversation

bbarker
Copy link

@bbarker bbarker commented Jun 27, 2019

What does this pull request do?

A few readme fixes

Other issues

The example does not work for me as yet. I get this error (prepackaged example with imports):

Compiling Metajelo.Forms
Error found:
in module Metajelo.Forms
at src/Metajelo/Forms.purs:48:27 - 48:30 (line 48, column 27 - line 48, column 30)

  Could not match type
                                        
    { dirty :: Boolean                  
    , errors :: Int                     
    , form :: t1 Record FormField       
    , internal :: InternalState t1 Maybe
    , submitAttempts :: Int             
    , submitting :: Boolean             
    , validity :: ValidStatus           
    }                                   
                                        
  with type
          
    Record
          

while trying to match type Either                                
                             { dirty :: Boolean                  
                             , errors :: Int                     
                             , form :: t1 Record FormField       
                             , internal :: InternalState t1 Maybe
                             , submitAttempts :: Int             
                             , submitting :: Boolean             
                             , validity :: ValidStatus           
                             }                                   
  with type t0 Record
while checking that expression res
  has type Maybe (t0 Record OutputField)
in binding group formStWidget

where t1 is an unknown type
      t0 is an unknown type

@ajnsit
Copy link
Owner

ajnsit commented Jun 29, 2019

Thanks for the fixes! I will look into the example.

@ajnsit ajnsit merged commit ae713e6 into ajnsit:master Jun 29, 2019
@ajnsit
Copy link
Owner

ajnsit commented Jun 29, 2019

@bbarker I figured out the problem. The docs for concur-formless are a bit stale. I had made a few changes to the API to simplify it.

The major changes you need to make are -

  1. F.eval takes the current state of the form as a parameter.
  2. F.eval returns an Either State Output instead of a Maybe Output. It used to handle the state intrinsically using the state monad, but now it requires explicit passing of state around. This makes it simpler and clearer to use, since you can still easily package it up in the state monad if needed.

Also, your example was also missing a few steps with defining forms, specifically a "Form" datatype and associated things (such as validations). I went ahead and completed the form example in my own fork - https://github.com/ajnsit/metajelo-ui. You can simply run spago and parcel to see it in action (exact commandlines in the README). The new sources are in the /src folder directly since it was easier for me to work with them that way.

Please feel free to open issues if anything is unclear!

@ajnsit
Copy link
Owner

ajnsit commented Jun 29, 2019

This is what it looks like on my system - Screenshot 2019-06-29 at 4 03 04 PM

@bbarker
Copy link
Author

bbarker commented Jun 30, 2019

Thanks! yes, I thought I was probably missing some important bits that I had read about earlier, but was trying to get something up and running.

Should I go ahead and switch to purescript-formless-independent?

@ajnsit
Copy link
Owner

ajnsit commented Jun 30, 2019

Yeah, I am going to deprecate concur-formless in favor of formless-independent soon. However I also opened an issue with main formless repository to see if they would want to create a formless-core repo instead. If they agree then it might be less work to simply switch to the official formless-core in one go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants