Created
July 5, 2010 04:33
-
-
Save ujihisa/463997 to your computer and use it in GitHub Desktop.
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
import System | |
class Hi a where | |
hi :: a -> String | |
data Ujihisa = Ujihisa | |
instance Hi Ujihisa where | |
hi = "my name is ujihisa" | |
data Ujm = Ujm | |
instance Hi Ujm where | |
hi = "this is a pen" | |
main = do x <- getArgs | |
let the_klass = if length x == 1 then Ujihisa else Ujm | |
print $ hi the_klass | |
/var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/vv6A9jF/341:4:61: | |
Couldn't match expected type `Ujihisa' against inferred type `Ujm' | |
In the expression: Ujm | |
In the expression: if length x == 1 then Ujihisa else Ujm | |
In the definition of `the_klass': | |
the_klass = if length x == 1 then Ujihisa else Ujm | |
/var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/vv6A9jF/341:12:7: | |
Couldn't match expected type `Ujihisa -> String' | |
against inferred type `[Char]' | |
In the expression: "my name is ujihisa" | |
In the definition of `hi': hi = "my name is ujihisa" | |
In the instance declaration for `Hi Ujihisa' | |
/var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/vv6A9jF/341:16:7: | |
Couldn't match expected type `Ujm -> String' | |
against inferred type `[Char]' | |
In the expression: "this is a pen" | |
In the definition of `hi': hi = "this is a pen" | |
In the instance declaration for `Hi Ujm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment