-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add paramListOrNothing function #1130
Add paramListOrNothing function #1130
Conversation
The type errors comes from changes to the Schema Compiler, basically the Try to run this:
After this the error should be gone |
Co-authored-by: Marc Scholten <[email protected]>
IHP> :l IHP/IHP/SchemaCompiler.hs
[ 1 of 16] Compiling IHP.HaskellSupport ( IHP/IHP/HaskellSupport.hs, interpreted )
[ 2 of 16] Compiling IHP.Log.Types ( IHP/IHP/Log/Types.hs, interpreted )
[ 3 of 16] Compiling IHP.Log ( IHP/IHP/Log.hs, interpreted )
[ 4 of 16] Compiling IHP.NameSupport.Inflections.Data ( IHP/IHP/NameSupport/Inflections/Data.hs, interpreted )
[ 5 of 16] Compiling IHP.NameSupport.Inflections ( IHP/IHP/NameSupport/Inflections.hs, interpreted )
[ 6 of 16] Compiling IHP.NameSupport ( IHP/IHP/NameSupport.hs, interpreted )
[ 7 of 16] Compiling IHP.Postgres.Inet ( IHP/IHP/Postgres/Inet.hs, interpreted )
[ 8 of 16] Compiling IHP.Postgres.Point ( IHP/IHP/Postgres/Point.hs, interpreted )
[ 9 of 16] Compiling IHP.Postgres.TypeInfo ( IHP/IHP/Postgres/TypeInfo.hs, interpreted )
[10 of 16] Compiling IHP.Postgres.TSVector ( IHP/IHP/Postgres/TSVector.hs, interpreted )
[11 of 16] Compiling IHP.ModelSupport ( IHP/IHP/ModelSupport.hs, interpreted )
[12 of 16] Compiling IHP.Prelude ( IHP/IHP/Prelude.hs, interpreted )
[13 of 16] Compiling IHP.IDE.SchemaDesigner.Types ( IHP/IHP/IDE/SchemaDesigner/Types.hs, interpreted )
[14 of 16] Compiling IHP.IDE.SchemaDesigner.Parser ( IHP/IHP/IDE/SchemaDesigner/Parser.hs, interpreted )
[15 of 16] Compiling IHP.IDE.SchemaDesigner.Compiler ( IHP/IHP/IDE/SchemaDesigner/Compiler.hs, interpreted )
[16 of 16] Compiling IHP.SchemaCompiler ( IHP/IHP/SchemaCompiler.hs, interpreted )
However then I try to
IHP> :l Main
[ 1 of 128] Compiling IHP.HSX.Parser ( IHP/IHP/HSX/Parser.hs, interpreted )
[ 2 of 128] Compiling IHP.HaskellSupport ( IHP/IHP/HaskellSupport.hs, interpreted )
[ 3 of 128] Compiling IHP.Log.Types ( IHP/IHP/Log/Types.hs, interpreted )
[ 4 of 128] Compiling IHP.Log ( IHP/IHP/Log.hs, interpreted )
[ 5 of 128] Compiling IHP.NameSupport.Inflections.Data ( IHP/IHP/NameSupport/Inflections/Data.hs, interpreted )
[ 6 of 128] Compiling IHP.NameSupport.Inflections ( IHP/IHP/NameSupport/Inflections.hs, interpreted )
[ 7 of 128] Compiling IHP.NameSupport ( IHP/IHP/NameSupport.hs, interpreted )
[ 8 of 128] Compiling IHP.Postgres.Inet ( IHP/IHP/Postgres/Inet.hs, interpreted )
[ 9 of 128] Compiling IHP.Postgres.Point ( IHP/IHP/Postgres/Point.hs, interpreted )
[ 10 of 128] Compiling IHP.Postgres.TypeInfo ( IHP/IHP/Postgres/TypeInfo.hs, interpreted )
[ 11 of 128] Compiling IHP.Postgres.TSVector ( IHP/IHP/Postgres/TSVector.hs, interpreted )
[ 12 of 128] Compiling IHP.ModelSupport ( IHP/IHP/ModelSupport.hs, interpreted )
[ 13 of 128] Compiling IHP.Prelude ( IHP/IHP/Prelude.hs, interpreted )
[ 14 of 128] Compiling IHP.Pagination.Types ( IHP/IHP/Pagination/Types.hs, interpreted )
[ 15 of 128] Compiling IHP.Pagination.Helpers ( IHP/IHP/Pagination/Helpers.hs, interpreted )
[ 16 of 128] Compiling IHP.PageHead.Types ( IHP/IHP/PageHead/Types.hs, interpreted )
[ 17 of 128] Compiling IHP.PGNotify ( IHP/IHP/PGNotify.hs, interpreted )
[ 18 of 128] Compiling IHP.Modal.Types ( IHP/IHP/Modal/Types.hs, interpreted )
[ 19 of 128] Compiling IHP.Mail.Types ( IHP/IHP/Mail/Types.hs, interpreted )
[ 20 of 128] Compiling IHP.LoginSupport.Types ( IHP/IHP/LoginSupport/Types.hs, interpreted )
[ 21 of 128] Compiling IHP.LibDir ( IHP/IHP/LibDir.hs, interpreted )
[ 22 of 128] Compiling IHP.Job.Dashboard.Utils ( IHP/IHP/Job/Dashboard/Utils.hs, interpreted )
[ 23 of 128] Compiling IHP.FlashMessages.Types ( IHP/IHP/FlashMessages/Types.hs, interpreted )
[ 24 of 128] Compiling IHP.FileStorage.Types ( IHP/IHP/FileStorage/Types.hs, interpreted )
[ 25 of 128] Compiling IHP.FileStorage.Preprocessor.ImageMagick ( IHP/IHP/FileStorage/Preprocessor/ImageMagick.hs, interpreted )
[ 26 of 128] Compiling IHP.FileStorage.MimeTypes ( IHP/IHP/FileStorage/MimeTypes.hs, interpreted )
[ 27 of 128] Compiling IHP.Environment ( IHP/IHP/Environment.hs, interpreted )
[ 28 of 128] Compiling IHP.AuthSupport.View.Sessions.New ( IHP/IHP/AuthSupport/View/Sessions/New.hs, interpreted )
[ 29 of 128] Compiling IHP.AuthSupport.Lockable ( IHP/IHP/AuthSupport/Lockable.hs, interpreted )
[ 30 of 128] Compiling IHP.AuthSupport.Authorization ( IHP/IHP/AuthSupport/Authorization.hs, interpreted )
[ 31 of 128] Compiling IHP.AuthSupport.Authentication ( IHP/IHP/AuthSupport/Authentication.hs, interpreted )
[ 32 of 128] Compiling IHP.Assets.Types ( IHP/IHP/Assets/Types.hs, interpreted )
[ 33 of 128] Compiling IHP.Router.Types ( IHP/IHP/Router/Types.hs, interpreted )
[ 34 of 128] Compiling IHP.ValidationSupport.Types ( IHP/IHP/ValidationSupport/Types.hs, interpreted )
[ 35 of 128] Compiling IHP.ValidationSupport.ValidateField ( IHP/IHP/ValidationSupport/ValidateField.hs, interpreted )
|
Did you run the |
Oops, I missed that - works now! I'll try to add some tests... |
btw, worth probably adding that to the Contribution? I'm still unable to get hspec to work. In fact I've spinned of a GitPod.io workspace, added @mpscholten You should have access to it - https://indigo-ostrich-lcv17mqs.ws-eu18.gitpod.io/ |
Yes, we could add it 👍 Best to add it to the
To run the IHP tests: cd IHP
nix-shell
ghci
:l Test/Main
main
# after you made some changes
:r
main |
Try the suggested fix in the warning there. That should fix it :) |
I meant the Try running |
Haha, so many newbie mistakes 🤕 |
Perfect :) no worries! |
Test/Controller/ParamSpec.hs
Outdated
describe "paramListOrNothing" do | ||
it "should parse valid input" do | ||
let ?context = createControllerContextWithParams [("ingredients", "milk"), ("ingredients", ""), ("ingredients", "egg")] | ||
(paramListOrNothing @Text "ingredients") `shouldBe` [Just "milk", Just "", Just "egg"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think Just ""
is correct here, or would you expect it to be Nothing (since value is empty)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO for empty text it should Nothing, but wasn't sure :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's consistent with paramOrNothin
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, good job :)
Trying to address #1099 (comment)
I have followed https://github.com/digitallyinduced/ihp/blob/5f9f65ae272a9a3d1c8c89c0ce5cfe2391ad057c/CONTRIBUTING.md but facing an error upon compilation, so I could use some help here 😅