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

Adding operators for collections and numbers #286

Merged
merged 2 commits into from
May 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 55 additions & 11 deletions src/Language/Mulang/Ast/Operator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,87 @@ import GHC.Generics

data Operator
= Equal
-- equal operator
-- ^ `==`-like equal operator
| NotEqual
-- ^ distinct operator
-- ^ `!==`-like distinct operator
| Negation
-- ^ not operator
-- ^ `!`-like not operator
| And
-- ^ and operator
-- ^ `&&`-like and operator
| Or
-- ^ or operator
-- ^ `||`-like or operator
| Hash
-- ^ hashcode operator
| GreatherOrEqualThan
-- ^ `>=` operator
| GreatherThan
-- ^ `>` operator
| LessOrEqualThan
-- ^ `<=` operator
| LessThan
-- ^ `<` operator
| Otherwise
-- ^ guard's otherwise operator
| Plus
-- ^ numeric `+` operator
| Minus
-- ^ numeric `-` operator
| Multiply
-- ^ numeric `*` operator
| Divide
-- ^ numeric `/` operator
| ForwardComposition
-- (f >> g)(x) = (g . f)(x) = g(f(x)) operator
| BackwardComposition
-- (f << g)(x) = (f . g)(x) = f(g(x)) operator
| Modulo
-- ^ % operator
-- ^ numeric `%-like` modulo operator
| BitwiseOr
-- ^ bit-level or operator |
-- ^ bit-level `|`-like or operator
| BitwiseAnd
-- ^ bit-level and operator &
-- ^ bit-level `&`-like and operator
| BitwiseXor
-- ^ bit-level xor operator
-- ^ bit-level `^`-like xor operator
| BitwiseLeftShift
-- ^ bit-level left shift operator <<
-- ^ bit-level left `<<`-like shift operator
| BitwiseRightShift
-- ^ bit-level right shift operator >>
-- ^ bit-level right `>>`-like shift operator
| Absolute
-- ^ numeric `abs`-like absolute operator
| Round
-- ^ numeric `round`-like round operator
| Ceil
-- ^ numeric `ceil`-like ceiling operator
| Floor
-- ^ numeric `ceil`-like floor operator
| Max
-- ^ `max`-like maximum value binary operator
| Min
-- ^ `min`-like minimum value binary operator
| Size
-- ^ collection `length`-like size operator
| Detect
-- ^ collection `find`-like search operator
| DetectMax
-- ^ collection `max`-like maximum operator
| DetectMin
-- ^ collection `min`-like minumum operator
| Count
-- ^ collection `count`-like operator
| Select
-- ^ collection `filter`-like operator
| Collect
-- ^ collection `map`-like operator
| Inject
-- ^ collection `reduce`-like / `fold`-like operator
| AllSatisfy
-- ^ collection `all`-like / `every`-like operator
| AnySatisfy
-- ^ collection `any`-like / `some`-like operator
| Flatten
-- ^ collection `flatten`-like operator
| Gather
-- ^ collection `flatmap`-like operator
deriving (Eq, Show, Read, Generic, Ord, Enum)