Skip to content

Instantly share code, notes, and snippets.

@pstiasny
Created February 28, 2016 02:20
Show Gist options
  • Save pstiasny/97cc15dc8048b20c93f3 to your computer and use it in GitHub Desktop.
Save pstiasny/97cc15dc8048b20c93f3 to your computer and use it in GitHub Desktop.
{-# LANGUAGE UnicodeSyntax #-}
type ℝ = Float
data ℝ³ = ℝ³ !ℝ !ℝ !ℝ deriving (Show)
(⋅) ∷ ℝ³ → ℝ³ → ℝ
(ℝ³ x1 x2 x3) ⋅ (ℝ³ y1 y2 y3) = x1 * y1 + x2 * y2 + x3 * y3
main =
let x = ℝ³ 2 0 1
y = ℝ³ 6 0 0
in print $ x ⋅ y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment