-
Notifications
You must be signed in to change notification settings - Fork 53
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
Move Heading and conversions to Location module #1103
Conversation
src/Swarm/Game/Location.hs
Outdated
DAbsolute e -> cardinal $ toHeading e | ||
where | ||
cardinal = const | ||
relative = id |
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.
What is the point of defining relative = id
? Why not just have DLeft -> perp
and so on? (Maybe this code was already like that but I didn't notice before.)
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.
No good reason, I think we originally used it for the absolute/relative distinction, but that has disappeared with the direction constructors.
src/Swarm/Language/Syntax.hs
Outdated
|
||
cardinal = DirInfo directionSyntax . const | ||
relative = DirInfo directionSyntax | ||
-- | Direction name is generate from Direction data constuctor |
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.
-- | Direction name is generate from Direction data constuctor | |
-- | Direction name is generated from Direction data constuctor |
src/Swarm/Game/Location.hs
Outdated
applyTurn d = case d of | ||
DRelative e -> case e of | ||
DLeft -> relative perp | ||
DRight -> relative (fmap negate . perp) |
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.
I've been meaning to replace fmap negate
with just negated
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.
Neat, thanks! 👍
DirInfo
typeDirection -> Heading
functions to theLocation
module