-
-
Save Apanatshka/736548c4f1d6aeb98ba7 to your computer and use it in GitHub Desktop.
This file contains 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
type Body x = { pos:(Int,Int), wrap : x } | |
type Bubble = { radius: Int } | |
type Box = { w: Int, h: Int } | |
data Wrap = WBox Box | WBubble Bubble | |
mv: (Int,Int) -> Body a -> Body a | |
mv (x,y) body = | |
let (x0,y0)= body.pos | |
in { body | pos <- (x0+x, y0+y)} | |
myBubble = Body (0,0) <| WBubble {radius=10} | |
myBox = Body (10,10) <| WBox {w=5, h=5} | |
bodies = [myBox,myBubble] | |
main = asText (map (mv (1,1)) bodies) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment