Created
October 3, 2011 11:02
-
-
Save mwotton/1258892 to your computer and use it in GitHub Desktop.
test
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 OverloadedStrings #-} | |
import Lengthable | |
import Prelude hiding (length) | |
import qualified Data.Text | |
import Data.Text(Text(..)) | |
text :: Text | |
text = "abcdefg" | |
main = do print $ length [1,2,3] | |
print $ length text | |
---- lengthable.hs | |
module Lengthable where | |
import qualified Data.Text | |
import qualified Data.List | |
class Lengthable a where | |
length :: a -> Int | |
instance Lengthable Data.Text.Text where | |
length = Data.Text.length | |
instance Lengthable [a] where | |
length = Data.List.length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment