Skip to content

Instantly share code, notes, and snippets.

@ttuegel
Last active August 29, 2015 14:00
Show Gist options
  • Save ttuegel/11263212 to your computer and use it in GitHub Desktop.
Save ttuegel/11263212 to your computer and use it in GitHub Desktop.
Stupid array shape strawman
{-# LANGUAGE TypeOperators #-}
-- Ignore the names, these are just tuples, not type lists
data major :. minor = major :. minor -- Row major shapes
data minor .: major = minor .: major -- Col major shapes
class Shape sh where
type Index sh
index :: sh -> Index sh -> Int
inRange :: sh -> Index sh -> Bool
size :: sh -> Int
-- instances, blah
newtype Sparse a = Sparse a
-- The instances for Sparse will have to do compression
data Array shape el = Array shape {- bounds -} (Vector el) {- data -}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment