feat(Tuples): add tuple elements of unlimited length#50
Merged
emqplus merged 2 commits intohamler-lang:hamlerfrom Jun 23, 2020
Merged
feat(Tuples): add tuple elements of unlimited length#50emqplus merged 2 commits intohamler-lang:hamlerfrom
emqplus merged 2 commits intohamler-lang:hamlerfrom
Conversation
|
emqplus
requested changes
Jun 23, 2020
| lit ns (TupleLiteral6 a b c d e f) = foldl go ns [a,b,c,d,e,f] | ||
| lit ns (TupleLiteral7 a b c d e f g) = foldl go ns [a,b,c,d,e,f,g] | ||
|
|
||
| lit ns (TuplesLiteral xs) = foldl go ns xs |
| | CannotDefinePrimModules ModuleName | ||
| | MixedAssociativityError (NEL.NonEmpty (Qualified (OpName 'AnyOpName), Associativity)) | ||
| | NonAssociativeError (NEL.NonEmpty (Qualified (OpName 'AnyOpName))) | ||
| | TuplesLengthDifferent Int Int |
There was a problem hiding this comment.
TuplesLengthDifferent -> TupleLengthDifferent
| | TupleLiteral6 a a a a a a | ||
| | TupleLiteral7 a a a a a a a | ||
|
|
||
| | TuplesLiteral [a] |
| show (TupleLiteral6 a b c d e f) = "(" <> show a <> "," <> show b <> "," <> show c <> "," <> show d <> "," <> show e <> "," <> show f <> ")" | ||
| show (TupleLiteral7 a b c d e f g) = "(" <> show a <> "," <> show b <> "," <> show c <> "," <> show d <> "," <> show e <> "," <> show f <> "," <> show g <> ")" | ||
|
|
||
| show (TuplesLiteral xs) = "(" <> show xs <> ")" |
| f' <- go f | ||
| g' <- go g | ||
| return $ TupleLiteral7 a' b' c' d' e' f' g' | ||
| litM go (TuplesLiteral xs) = TuplesLiteral <$> traverse go xs |
src/Language/PureScript/Types.hs
Outdated
| go bound (ForAll _ v _ t _) = go (v : bound) t | ||
| go bound (ConstrainedType _ c t) = concatMap (go bound) (constraintArgs c) ++ go bound t | ||
| go bound (RCons _ _ t r) = go bound t ++ go bound r | ||
| go bound (Tuples _ t r) = go bound t ++ go bound r |
src/Language/PureScript/Types.hs
Outdated
| go (ForAll ann arg mbK ty sco) = f (ForAll ann arg mbK (go ty) sco) | ||
| go (ConstrainedType ann c ty) = f (ConstrainedType ann (mapConstraintArgs (map go) c) (go ty)) | ||
| go (RCons ann name ty rest) = f (RCons ann name (go ty) (go rest)) | ||
| go (Tuples ann ty rest) = f (Tuples ann (go ty) (go rest)) |
src/Language/PureScript/Types.hs
Outdated
| go (ForAll ann arg mbK ty sco) = ForAll ann arg mbK (go (f ty)) sco | ||
| go (ConstrainedType ann c ty) = ConstrainedType ann (mapConstraintArgs (map (go . f)) c) (go (f ty)) | ||
| go (RCons ann name ty rest) = RCons ann name (go (f ty)) (go (f rest)) | ||
| go (Tuples ann ty rest) = Tuples ann (go (f ty)) (go (f rest)) |
src/Language/PureScript/Types.hs
Outdated
| go (ForAll ann arg mbK ty sco) = (ForAll ann arg mbK <$> go ty <*> pure sco) >>= f | ||
| go (ConstrainedType ann c ty) = (ConstrainedType ann <$> overConstraintArgs (mapM go) c <*> go ty) >>= f | ||
| go (RCons ann name ty rest) = (RCons ann name <$> go ty <*> go rest) >>= f | ||
| go (Tuples ann ty rest) = (Tuples ann <$> go ty <*> go rest) >>= f |
src/Language/PureScript/Types.hs
Outdated
|
|
||
| compareType (Tuples _ b c) (Tuples _ b' c') = compareType b b' <> compareType c c' | ||
| compareType (Tuples {}) _ = LT | ||
| compareType _ (Tuples {}) = GT |
emqplus
approved these changes
Jun 23, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.