Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #299
| From | Mark Carroll <mtbc@bcs.org> |
|---|---|
| Newsgroups | comp.lang.haskell |
| Subject | Re: ghci list typeclasses that a type is in |
| Date | 2014-10-24 12:53 +0100 |
| Organization | none |
| Message-ID | <87bnp1k7jf.fsf@ixod.org> (permalink) |
| References | <87oat1oghi.fsf@brighton.ac.uk> |
Jim Burton <j.burton@brighton.ac.uk> writes: > Hi, is it possible to use ghci to list all typeclasses that some type is > an instance of? E.g. I can use :info Eq to see all instances of Eq, but > I want to do it the other way round, e.g. :info String... It will usually work the other way around: your problem with String is that it isn't a type in its own right, it's just an alias for a list of Char: Prelude> :info Char data Char = GHC.Types.C# GHC.Prim.Char# -- Defined in `GHC.Types' instance Bounded Char -- Defined in `GHC.Enum' instance Enum Char -- Defined in `GHC.Enum' instance Eq Char -- Defined in `GHC.Classes' instance Ord Char -- Defined in `GHC.Classes' instance Read Char -- Defined in `GHC.Read' instance Show Char -- Defined in `GHC.Show' Prelude> ['a','b','c'] "abc" -- Mark
Back to comp.lang.haskell | Previous | Next — Previous in thread | Find similar | Unroll thread
ghci list typeclasses that a type is in Jim Burton <j.burton@brighton.ac.uk> - 2014-10-24 12:27 +0100 Re: ghci list typeclasses that a type is in Mark Carroll <mtbc@bcs.org> - 2014-10-24 12:53 +0100
csiph-web