Created
June 25, 2017 02:27
-
-
Save dobkeratops/2ddc3f1a6e8099668786ce32e674c922 to your computer and use it in GitHub Desktop.
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
data Entity=Entity{name::String,pos::Vec3f} | |
data Trigger=Trigger{name::String,num::Int} | |
class HasName x where | |
nameOf :: x -> String | |
instance HasName Entity where | |
nameOf Entity{name=x}=x | |
instance HasName Trigger where | |
nameOf Trigger{name=x}=x | |
test_struct::String | |
test_struct =let | |
ent = Entity "foo" (Vec3 0.0 0.5 1.0) | |
trigger= Trigger"bar" 15 | |
in | |
nameOf ent ++ nameOf trigger | |
-- result: "foobar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment