[project @ 2005-09-16 11:23:45 by simonmar]
[ghc-hetmet.git] / ghc / docs / vh / vh.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 ]>
5
6   <article id="visual-haskell">
7   
8     <articleinfo>
9
10       <title>Visual Haskell User's Guide</title>
11     <author>
12       <firstname>Simon</firstname>
13       <surname>Marlow</surname>
14       <email>simonmar@microsoft.com</email>
15     </author>
16     <author>
17       <firstname>Krasimir</firstname>
18       <surname>Angelov</surname>
19       <email>kr.angelov@gmail.com</email>
20     </author>
21
22 <!--
23     <abstract>
24       <para></para>
25     </abstract>
26 -->
27
28     </articleinfo>
29
30     <section id="sec-introduction">
31       <title>Introduction</title>
32       
33       <para>Visual Haskell is a plugin for Microsoft's Visual Studio
34         development environment to support development of Haskell software.
35         Like the other Visual languages, Visual Haskell integrates with the
36         Visual Studio editor to provide interactive features to aid Haskell
37         development, and it enables the construction of projects consisting of
38         multiple Haskell modules.</para>
39
40       <section id="sec-obtaining">
41         <title>Installing Visual Haskell</title>
42
43         <para>In order to use Visual Haskell, you need <ulink url="http://msdn.microsoft.com/vstudio/productinfo/">Visual Studio .NET
44           2003</ulink>.  Right now, this is the only supported version of Visual
45           Studio - unfortunately we haven't yet added support for the 2005
46           Beta.  The Express languages (Visual C++ Express etc.) also will not
47           work, because they don't have support for plugins.</para>
48
49         <para>You don't need to install GHC separately: Visual Haskell
50           is bundled with a complete GHC distribution, and various other tools
51           (Happy, Alex, Haddock).</para>
52
53         <para>The latest Visual Haskell installer can be obtained from
54           here:</para>
55
56         <para><ulink
57           url="http://research.microsoft.com/downloads/"><literal>http://research.microsoft.com/downloads/</literal></ulink></para>
58       </section>
59
60       <section id="release-notes">
61         <title>Release Notes</title>
62
63         <section>
64           <title>Version 0.0, first release</title>
65           
66           <para>This release is a technology preview, and should be considered
67             alpha quality.  It works for us, but you are fairly likely to
68             encounter problems.  If you're willing to try it out and report
69             bugs, we'd be grateful for the feedback.</para>
70
71           <itemizedlist>
72             <listitem>
73               <para>This release of Visual Haskell is bundled with a
74                 development snapshot of GHC, version 6.5 from around 14
75                 September 2005.  This version of GHC is used to provide the
76                 interactive editing features, and will be used to compile all
77                 code inside Visual Haskell.  It is possible that in future
78                 releases we may be able to relax this tight coupling between
79                 Visual Haskell and the bundled GHC.</para>
80
81               <para>Please note that future releases of Visual
82                 Haskell will update the compiler, and hence the
83                 packages, and so may break your code.  Also note that because
84                 the bundled GHC is not a released version, it may have bugs and
85                 quirks itself: please report them as usual to
86                 <email>glasgow-haskell-bugs@haskell.org</email>.</para>
87             </listitem>
88           </itemizedlist>
89         </section>
90       </section>
91
92       <section id="sec-bugs">
93         <title>Getting support, reporting bugs</title>
94         <para>Please report bugs to
95           <email>glasgow-haskell-bugs@haskell.org</email> (subscribe <ulink url="http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs">here</ulink>), clearly indicating
96           that your bug report relates to Visual Haskell, and giving as much
97           information as possible so that we can reproduce the bug.  Even if
98           you can't reproduce the bug reliably, it is still useful to report
99           what you've seen.</para>
100
101         <para>For help and support, use the
102           <email>glasgow-haskell-users@haskell.org</email> (subscribe <ulink
103             url="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users">here</ulink>) mailing list.</para>
104       </section>
105
106       <section id="sec-license">
107         <title>License</title>
108
109         <para>The license is the standard Microsoft Shared Source license.  We may be
110           able to relax certain aspects of this license in future releases
111           (please contact us if this license is unsuitable for you).  The
112           license is as follows:</para>
113
114 <blockquote>
115 <para>This Microsoft Research Shared Source license agreement ("MSR-SSLA")
116 is a legal agreement between you and Microsoft Corporation
117 ("Microsoft" or "we") for the software or data identified above, which
118 may include source code, and any associated materials, text or speech
119 files, associated media and "online" or electronic documentation and
120 any updates we provide in our discretion (together, the "Software").</para>
121
122 <para>By installing, copying, or otherwise using this Software, found at
123 http://research.microsoft.com/downloads, you agree to be bound by the
124 terms of this MSR-SSLA. If you do not agree, do not install copy or
125 use the Software. The Software is protected by copyright and other
126 intellectual property laws and is licensed, not sold.
127 </para>
128
129 <para>SCOPE OF RIGHTS:
130 </para>
131
132 <para>You may use, copy, reproduce, and distribute this Software for any
133 non-commercial purpose, subject to the restrictions in this
134 MSR-SSLA. Some purposes which can be non-commercial are teaching,
135 academic research, public demonstrations and personal
136 experimentation. You may also distribute this Software with books or
137 other teaching materials, or publish the Software on websites, that
138 are intended to teach the use of the Software for academic or other
139 non-commercial purposes.
140 </para>
141
142 <para>You may not use or distribute this Software or any derivative works in
143 any form for commercial purposes. Examples of commercial purposes
144 would be running business operations, licensing, leasing, or selling
145 the Software, distributing the Software for use with commercial
146 products, using the Software in the creation or use of commercial
147 products or any other activity which purpose is to procure a
148 commercial gain to you or others.
149 </para>
150
151 <para>If the Software includes source code or data, you may create
152 derivative works of such portions of the Software and distribute the
153 modified Software for non-commercial purposes, as provided herein.
154 </para>
155
156 <para>In return, we simply require that you agree: 
157 </para>
158
159 <para>1. That you will not remove any copyright or other notices from the Software.
160 </para>
161
162 <para>2. That if any of the Software is in binary format, you will not
163 attempt to modify such portions of the Software, or to reverse
164 engineer or decompile them, except and only to the extent authorized
165 by applicable law.
166 </para>
167
168 <para>3. That if you distribute the Software or any derivative works of the
169 Software, you will distribute them under the same terms and conditions
170 as in this license, and you will not grant other rights to the
171 Software or derivative works that are different from those provided by
172 this MSR-SSLA.
173 </para>
174
175 <para>4. That if you have created derivative works of the Software, and
176 distribute such derivative works, you will cause the modified files to
177 carry prominent notices so that recipients know that they are not
178 receiving the original Software. Such notices must state: (i) that you
179 have changed the Software; and (ii) the date of any changes.
180 </para>
181
182 <para>5. That Microsoft is granted back, without any restrictions or
183 limitations, a non-exclusive, perpetual, irrevocable, royalty-free,
184 assignable and sub-licensable license, to reproduce, publicly perform
185 or display, install, use, modify, distribute, make and have made, sell
186 and transfer your modifications to and/or derivative works of the
187 Software source code or data, for any purpose.
188 </para>
189
190 <para>6. That any feedback about the Software provided by you to us is
191 voluntarily given, and Microsoft shall be free to use the feedback as
192 it sees fit without obligation or restriction of any kind, even if the
193 feedback is designated by you as confidential.
194 </para>
195
196 <para>7. THAT THE SOFTWARE COMES "AS IS", WITH NO WARRANTIES. THIS MEANS NO
197 EXPRESS, IMPLIED OR STATUTORY WARRANTY, INCLUDING WITHOUT LIMITATION,
198 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ANY
199 WARRANTY AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE SOFTWARE OR
200 ANY WARRANTY OF TITLE OR NON-INFRINGEMENT. THERE IS NO WARRANTY THAT
201 THIS SOFTWARE WILL FULFILL ANY OF YOUR PARTICULAR PURPOSES OR
202 NEEDS. ALSO, YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE
203 THE SOFTWARE OR DERIVATIVE WORKS.
204 </para>
205
206 <para>8. THAT NEITHER MICROSOFT NOR ANY CONTRIBUTOR TO THE SOFTWARE WILL BE
207 LIABLE FOR ANY DAMAGES RELATED TO THE SOFTWARE OR THIS MSR-SSLA,
208 INCLUDING DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL OR INCIDENTAL
209 DAMAGES, TO THE MAXIMUM EXTENT THE LAW PERMITS, NO MATTER WHAT LEGAL
210 THEORY IT IS BASED ON. ALSO, YOU MUST PASS THIS LIMITATION OF
211 LIABILITY ON WHENEVER YOU DISTRIBUTE THE SOFTWARE OR DERIVATIVE WORKS.
212 </para>
213
214 <para>9. That we have no duty of reasonable care or lack of negligence, and
215 we are not obligated to (and will not) provide technical support for
216 the Software.
217 </para>
218
219 <para>10. That if you breach this MSR-SSLA or if you sue anyone over patents
220 that you think may apply to or read on the Software or anyone's use of
221 the Software, this MSR-SSLA (and your license and rights obtained
222 herein) terminate automatically.  Upon any such termination, you shall
223 destroy all of your copies of the Software immediately.  Sections 5,
224 6, 7, 8, 9, 10, 13 and 14 of this MSR-SSLA shall survive any
225 termination of this MSR-SSLA.
226 </para>
227
228 <para>11. That the patent rights, if any, granted to you in this MSR-SSLA
229 only apply to the Software, not to any derivative works you make.
230 </para>
231
232 <para>12. That the Software may be subject to U.S. export jurisdiction at
233 the time it is licensed to you, and it may be subject to additional
234 export or import laws in other places. You agree to comply with all
235 such laws and regulations that may apply to the Software after
236 delivery of the software to you.
237 </para>
238
239 <para>13. That all rights not expressly granted to you in this MSR-SSLA are
240 reserved.
241 </para>
242
243 <para>14. That this MSR-SSLA shall be construed and controlled by the laws
244 of the State of Washington, USA, without regard to conflicts of law.
245 If any provision of this MSR-SSLA shall be deemed unenforceable or
246 contrary to law, the rest of this MSR-SSLA shall remain in full effect
247 and interpreted in an enforceable manner that most nearly captures the
248 intent of the original language.
249 </para>
250
251 <para>Copyright © Microsoft Corporation. All rights reserved.</para>
252 <para>Copyright © The University of Glasgow.</para>
253 <para>Copyright © Krasimir Angelov.</para>
254         </blockquote>
255       </section>
256
257     </section>
258
259     <section id="sec-using">
260       <title>Using Visual Haskell</title>
261
262       <section>
263         <title>Overview of features</title>
264
265         <para>The following features are provided in the Visual Studio editor
266           when editing Haskell code:</para>
267
268         <itemizedlist>
269           <listitem>
270             <para>Automatic checking of code as you type, and visual indication
271               of parse errors, scoping errors and type errors.</para>
272           </listitem>
273           
274           <listitem>
275           <para>Quick info: hovering the mouse over an identifier pops up
276             an information box, including the type of the identifier.</para>
277           </listitem>
278
279           <listitem>
280           <para>A drop-down bar at the top of the editing window lists the
281             top-level declarations in the module, and allows quick navigation
282             to a declaration.</para>
283           </listitem>
284
285           <listitem>
286           <para>Name completion for identifiers in scope: press Ctrl+Space
287             after a partial identifier to see the completions.</para>
288           </listitem>
289
290           <listitem>
291           <para>Go to declaration: right clicking on an identifier and
292             selecting "Go to declaration" will jump the cursor to the
293             declaration of the identifier.  This works for locally-defined
294             identifiers and those defined in another module of the project; it
295             does not work for library functions currently.</para>
296           </listitem>
297         </itemizedlist>
298       </section>
299
300       <para>The following features are provided by the project system for
301         constructing Haskell projects:</para>
302
303       <itemizedlist>
304         <listitem>
305           <para>Multi-module Haskell projects are fully supported, based on the
306             <ulink url="http://www.haskell.org/cabal">Cabal</ulink>
307             infrastructure.  A project in Visual Haskell <emphasis>is</emphasis>
308             a Cabal package, and vice-versa.  A Visual Studio project can be
309             taken to a machine without Visual Haskell and built/installed as a
310             normal Cabal package, and an existing Cabal package can be edited
311             directly in Visual Haskell<footnote><para>This works as long as the
312                 Cabal package is using Cabal's simple build system; Cabal
313                 packages using their own build systems cannot be edited in Visual
314                 Haskell.</para>
315             </footnote>.</para>
316         </listitem>
317
318         <listitem>
319           <para>Editing of most of the package meta-data is supported through
320             the project property pages.</para>
321         </listitem>
322
323         <listitem>
324           <para>The interactive editing features work across multiple modules in
325             a project.  When one module is edited, changes are automatically
326             propagated to dependent modules, even if the edited module has not yet
327             been saved.</para>
328         </listitem>
329
330         <listitem>
331           <para>Building is supported through the Cabal build system, and build
332             errors are communicated back to the editor and placed in the task
333             list.  Use any of the Visual Studio build commands (e.g. Build
334             Project from the context menu on the project, or Ctrl-Shift-B to
335             build the whole solution).</para>
336         </listitem>
337
338       </itemizedlist>
339     
340     <para>Additionally, Visual Haskell is bundled with a large collection of
341       documentation: the GHC manual, the hierarchical libraries reference, and
342       other material all of which can be browsed within Visual Studio
343       itself.</para>
344
345     <section>
346       <title>Getting Started</title>
347       
348       <para>After installing Visual Haskell, start up Visual Studio as you
349         would normally, and observe that on the splash screen where it lists
350         the supported languages you should now see an icon for Visual
351         Haskell (if you don't see this, something has gone wrong... please let
352         us know).</para>
353       
354       <para>Firstly, take a look at the bundled documentation.  Go to
355         Help-&gt;Contents, and you should see the &ldquo;Visual Haskell Help
356         Collection&rdquo;, which contains a large collection of GHC and
357         Haskell-related documentaiton, including this document.</para>
358
359       <para>To start using Visual Haskell right away, create a new
360         project (File-&gt;New-&gt;Project...).  Select one of the Haskell
361         project types (Console Application or Library Package), and hit Ok.
362         The project will be created for you, and an example module
363         added: <literal>Main.hs</literal> for an application, or
364         <literal>Module1.hs</literal> for a library.</para>
365       
366       <para>You can now start adding code to
367         <literal>Main.hs</literal>, or adding new modules.  To add a new
368         module, right-click on the <literal>src</literal> directory, and
369         select Add-&gt;New Item.  Visual Haskell supports hierarchical
370         modules too: you can add new folders using the same Add menu to
371         create new nodes in the hierarchy.</para>
372       
373       <para>If you have any errors in your code, they will be underlined with
374         a red squiggly line.  Select the Tasks window (usually a tab near the
375         bottom of the Visual Studio window) to see the error messages, and
376         click on an error message to jump to it in the editor.</para>
377       
378       <para>To build the program, hit Ctrl-Shift-B, or select one of the
379         options from the Build menu.</para>
380     </section>
381
382     <section>
383       <title>Editing Haskell code</title>
384
385         <para>(ToDo: more detail here)</para>
386
387         <para>Your module must be plain Haskell (<literal>.hs</literal>) for the interactive features to
388         fully work.  If your module is pre-processed with CPP or Literate
389           Haskell, then Visual Haskell will only check the module when it is
390           saved; between saves the source will not be checked for errors and
391           the type information will not be updated.  If the source file is
392           pre-processed with Happy or another pre-processor, then you may have
393           to build the project before the type information will be updated
394           (because the pre-processor is only run as part of the build
395           process).  Pre-processed source files work fine in a multi-module
396           setting; you can have modules which depend on a pre-processed module
397           and full interactive checking will still be available in those
398           modules.</para>
399
400         <para>Because Visual Haskell is using GHC as a backend for its
401           interactive editing features, it supports the full GHC language,
402           including all extensions.</para>
403       </section>
404
405       <section>
406         <title>Using Projects</title>
407         <para>(ToDo: more detail here)</para>
408       </section>
409
410     </section>
411   </article>