[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-beginners
Subject: Re: [Haskell-beginners] OPERATOR OVERLOADING AS IN C++
From: Francesco Ariis <fa-ml () ariis ! it>
Date: 2017-02-14 13:18:19
Message-ID: 20170214131819.GA3107 () casa ! casa
[Download RAW message or body]
On Tue, Feb 14, 2017 at 06:21:37PM +0530, Praveen Velliengiri wrote:
> I'm new to functional programming, Whether it is possible to do operator
> overloading in Haskell ? I go through the Idea of TYPECLASSES in Learn you
> haskell tutorial. But I can't understand the idea Can anyone suggest me
> some idea regarding Operator overloading and Type classes in Haskell.
> Thank you guys
Hello Praveen,
indeed Haskell uses typeclasses to deal with ad hoc polymorphism.
Are you familiar with any of them? If I write in ghci:
λ> show 707
"707"
λ> show True
"True"
λ> show 'c'
"'c'"
λ> show "palla"
"\"palla\""
that is possible because numerous types are instances of the typeclass
Show, which provides `show`
λ> :t show
show :: Show a => a -> String
Does that help a bit? Or you aren't sure about the typeclass syntax?
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic