DojoDeveloppement/Mercredi6Juin2012Rétrospective de la session du /Mercredi30Mai2012 :
Sujets pour ce soir :
Tests.hs
{-#LANGUAGE TypeSynonymInstances#-}
{-#LANGUAGE FlexibleInstances#-}
module Tests where
import Test.HUnit
class Moche t where
make :: t
instance Moche String where
make = "x"
instance Moche (String->String) where
make = (\x->x)
printf :: Moche r => String -> r
printf "x" = make
printf "%s" = make
main = runTestTT $ TestList [
printf "x" ~?= "x",
printf "%s" "y" ~?= "y",
printf "%s" "z" ~?= "z",
printf "%s" ~?= "x"
]