Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
f2c68796
Commit
f2c68796
authored
Mar 18, 2002
by
simonpj
Browse files
[project @ 2002-03-18 15:27:08 by simonpj]
More on linear implicit params
parent
7d841483
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/docs/users_guide/glasgow_exts.sgml
View file @
f2c68796
...
@@ -918,12 +918,14 @@ written '<literal>%x</literal>' instead of '<literal>?x</literal>'.
...
@@ -918,12 +918,14 @@ written '<literal>%x</literal>' instead of '<literal>?x</literal>'.
<para>
<para>
For example:
For example:
<programlisting>
<programlisting>
import GHC.Exts( Splittable )
data NameSupply = ...
data NameSupply = ...
splitNS :: NameSupply -> (NameSupply, NameSupply)
splitNS :: NameSupply -> (NameSupply, NameSupply)
newName :: NameSupply -> Name
newName :: NameSupply -> Name
instance
PrelSplit.
Splittable NameSupply where
instance Splittable NameSupply where
split = splitNS
split = splitNS
...
@@ -954,7 +956,7 @@ the parameter explicit:
...
@@ -954,7 +956,7 @@ the parameter explicit:
Notice the call to 'split' introduced by the type checker.
Notice the call to 'split' introduced by the type checker.
How did it know to use 'splitNS'? Because what it really did
How did it know to use 'splitNS'? Because what it really did
was to introduce a call to the overloaded function 'split',
was to introduce a call to the overloaded function 'split',
defined by
defined by
the class <literal>Splittable</literal>:
<programlisting>
<programlisting>
class Splittable a where
class Splittable a where
split :: a -> (a,a)
split :: a -> (a,a)
...
@@ -968,8 +970,8 @@ and GHC will infer
...
@@ -968,8 +970,8 @@ and GHC will infer
<programlisting>
<programlisting>
g :: (Splittable a, %ns :: a) => b -> (b,a,a)
g :: (Splittable a, %ns :: a) => b -> (b,a,a)
</programlisting>
</programlisting>
The <literal>Splittable</literal> class is built into GHC. It's
defined in <literal>PrelSplit</literal>,
The <literal>Splittable</literal> class is built into GHC. It's
exported by module
and exported by
<literal>G
la
Exts</literal>.
<literal>G
HC.
Exts</literal>.
</para>
</para>
<para>
<para>
Other points:
Other points:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment