Created
June 16, 2018 13:09
-
-
Save madgen/a402a2c0e86b0387c71d96f1098d4ec9 to your computer and use it in GitHub Desktop.
How does type inference works on this?
This file contains hidden or 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
module MinskyGADT where | |
import Data.Array | |
import qualified Data.ByteString as BS | |
import Data.Word (Word8) | |
data GArrayLike a where | |
GArray :: Array Int a -> GArrayLike a | |
GBytes :: BS.ByteString -> GArrayLike Word8 | |
gLength (GArray a) = snd (bounds a) | |
gLength (GBytes b) = BS.length b | |
-- :t gLength | |
-- gLength :: GArrayLike e -> Int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment