Last active
August 29, 2015 14:00
-
-
Save ttuegel/11263212 to your computer and use it in GitHub Desktop.
Stupid array shape strawman
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
{-# 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