Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created October 3, 2011 11:02
Show Gist options
  • Save mwotton/1258892 to your computer and use it in GitHub Desktop.
Save mwotton/1258892 to your computer and use it in GitHub Desktop.
test
{-# 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