
While I am reading TypeCompose module, I am having trouble finding where ~> comes from? (And its son ~~> and grandson ~~~>, etc.) This is my immediate question. Help is appreciated. A bigger (higher-order?) issue I encountered and I think other people could also have is to look up all these special "symbols" during the learning curve. As things are getting higher and higher order in Haskell, more inventive symbols are appearing. It becomes harder to remember the exact definitions are. The difficulties are: 1) I used to see a page on haskell.org that lists many symbols, but I could not find that page any more. 2) You would hope there is a quick way to search those symbols. But most search engines do not treate symbols friendly, often just ignore them. I typed ~> in Hoogle, it also returned nothing. 3) If the module defining the symbol is not in standard library, it is not possible to look up the symbol in the core library index. The only way to find the symbol seems to go to the source code, check every module being imported and if I am lucky I will find it in the same package. If I am not lucky, I will have to search that module on the Internet, and hunt it down recursively. I wonder if anybody has the same problem. If enough crowd have the same problem, maybe there could be a better way to handle this kind of documentation/learning issue! Thanks, Steve

On 17/02/2008, Steve Lihn
While I am reading TypeCompose module, I am having trouble finding where ~> comes from? (And its son ~~> and grandson ~~~>, etc.) This is my immediate question. Help is appreciated.
(~>) is typically an infix type variable. If it were a constructor, it would have to start with a colon. So it doesn't have a definition as such, you can think of it as any type constructor with at least two type parameters. I think that would explain why you were having such trouble searching for it! Generally, though, if you want to know where something is defined, you can use ghci's :info command, and it should tell you the file and line in which it's defined, as well as its type (if it's a value) and its fixity (if it's an infix operator). You can then load up whatever documentation or source code is available for that module. Of course, in this case, it would report (correctly) that (~>) is not in scope. Usually, packages on Hackage have whatever documentation is available linked directly from their pages on Hackage. hope this helps! - Cale

Hi
2) You would hope there is a quick way to search those symbols. But most search engines do not treate symbols friendly, often just ignore them. I typed ~> in Hoogle, it also returned nothing. 3) If the module defining the symbol is not in standard library, it is not possible to look up the symbol in the core library index.
The next version of Hoogle will allow you to search all the modules on Hackage, i.e. it will find ~>. A month after I have written my thesis this will all be done :-) Thanks Neil

Am Sonntag, 17. Februar 2008 14:41 schrieb Neil Mitchell:
Hi
2) You would hope there is a quick way to search those symbols. But most search engines do not treate symbols friendly, often just ignore them. I typed ~> in Hoogle, it also returned nothing. 3) If the module defining the symbol is not in standard library, it is not possible to look up the symbol in the core library index.
The next version of Hoogle will allow you to search all the modules on Hackage, i.e. it will find ~>. A month after I have written my thesis this will all be done :-)
Thanks
Neil
I think, it won’t find it. As Cale said, it’s a type variable. It’s like the “a” in the following definition: data T a = T a a I think, Conal Elliott used an operator type variable in order to make his code more readable. The (~>) is a type parameter which stands for an arrow type. Best wishes, Wolfgang

| I think, it won’t find it. As Cale said, it’s a type variable. It’s like | the “a” in the following definition: | | data T a = T a a | | I think, Conal Elliott used an operator type variable in order to make his | code more readable. The (~>) is a type parameter which stands for an arrow | type. I've been thinking for some time that GHC's current lexicographic choice about type variables, although consistent, is an mistake. (I say "GHC" because Haskell 98 does not have operator symbols in the type namespace at all.) As of today, a is a type variable T is a type constructor ~> is a type variable :~> is a type constructor That's consistent with the syntax for data constructors. But it's a pain. For a start (->) is a type constructor not a type variable. More important, it's just so right to declare a sum type like this data a + b = Left a | Right b f :: a -> (a+b) f = ... But GHC currently makes you say data a :+: b = Left a | Right b f :: a -> (a:+:b) I hate those colons! The obvious thing is to say that operator symbols (of all kinds) are type constructors, and only alphabetic things are type variables. That's less consistent, but I think it might be more useful. I was provoked to type this by realising that Conal, at least, is using an operator symbol (~>) as a type variable. I wonder how bad it'd be in this case to have to use an alphabetic name (backquotes still work). Just flying a kite here -- this isn't high on my list. But the more we do at the type level, the more we want type expressions that look sensible. Simon
participants (5)
-
Cale Gibbard
-
Neil Mitchell
-
Simon Peyton-Jones
-
Steve Lihn
-
Wolfgang Jeltsch