-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0e2de5
commit d9b7e1a
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:set prompt "ghci> " |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Data.Vector | ||
( Vector(Vector) ) where | ||
|
||
data Vector a = Vector a a a | ||
deriving (Show, Eq) | ||
|
||
instance (Num a) => Num (Vector a) where | ||
(Vector x1 y1 z1) + (Vector x2 y2 z2) = Vector (x1+x2) (y1+y2) (z1+z2) | ||
(*) = undefined | ||
abs = undefined | ||
signum = undefined | ||
fromInteger = undefined | ||
negate = undefined |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
module Main where | ||
|
||
import Data.Vector | ||
|
||
_r :: Float | ||
_r = 1.0 | ||
_R :: Float | ||
_R = 2.0 | ||
|
||
drawCircle :: Vector Float -> [Vector Float] | ||
drawCircle center = map ((+) center . vradius) [0,0.1..2*pi] | ||
where | ||
vradius :: Float -> Vector Float | ||
vradius theta = Vector (_r * cos theta) (_r * sin theta) 0 | ||
|
||
render :: [[Char]] | ||
render = ["hello", "world"] | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, Haskell!" | ||
main = do | ||
let screen = unlines render | ||
putStr screen |