/usr/share/doc/libghc-diagrams-lib-doc/html/src/Diagrams-Trace.html is in libghc-diagrams-lib-doc 1.3.1.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/Diagrams/Trace.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE FlexibleContexts #-}</span>
<a name="line-2"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-3"></a><span class='hs-comment'>-- |</span>
<a name="line-4"></a><span class='hs-comment'>-- Module : Diagrams.Trace</span>
<a name="line-5"></a><span class='hs-comment'>-- Copyright : (c) 2013 diagrams-lib team (see LICENSE)</span>
<a name="line-6"></a><span class='hs-comment'>-- License : BSD-style (see LICENSE)</span>
<a name="line-7"></a><span class='hs-comment'>-- Maintainer : diagrams-discuss@googlegroups.com</span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- \"Traces\", aka embedded raytracers, for finding points on the edge</span>
<a name="line-10"></a><span class='hs-comment'>-- of a diagram. See "Diagrams.Core.Trace" for internal</span>
<a name="line-11"></a><span class='hs-comment'>-- implementation details.</span>
<a name="line-12"></a><span class='hs-comment'>--</span>
<a name="line-13"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Trace</span>
<a name="line-16"></a> <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Types</span>
<a name="line-17"></a> <span class='hs-conid'>Trace</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traced</span>
<a name="line-18"></a>
<a name="line-19"></a> <span class='hs-comment'>-- * Diagram traces</span>
<a name="line-20"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>trace</span><span class='hs-layout'>,</span> <span class='hs-varid'>setTrace</span><span class='hs-layout'>,</span> <span class='hs-varid'>withTrace</span>
<a name="line-21"></a>
<a name="line-22"></a> <span class='hs-comment'>-- * Querying traces</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>traceV</span><span class='hs-layout'>,</span> <span class='hs-varid'>traceP</span><span class='hs-layout'>,</span> <span class='hs-varid'>maxTraceV</span><span class='hs-layout'>,</span> <span class='hs-varid'>maxTraceP</span>
<a name="line-24"></a>
<a name="line-25"></a> <span class='hs-comment'>-- * Subdiagram traces</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>boundaryFrom</span><span class='hs-layout'>,</span> <span class='hs-varid'>boundaryFromMay</span>
<a name="line-27"></a>
<a name="line-28"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-29"></a>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span> <span class='hs-layout'>(</span><span class='hs-conid'>OrderedField</span><span class='hs-layout'>,</span> <span class='hs-conid'>Point</span><span class='hs-layout'>,</span> <span class='hs-conid'>Subdiagram</span><span class='hs-layout'>,</span> <span class='hs-varid'>location</span><span class='hs-layout'>,</span>
<a name="line-31"></a> <span class='hs-varid'>origin</span><span class='hs-layout'>,</span> <span class='hs-varid'>setTrace</span><span class='hs-layout'>,</span> <span class='hs-varid'>trace</span><span class='hs-layout'>)</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Trace</span>
<a name="line-33"></a>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Maybe</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Semigroup</span>
<a name="line-36"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Diagrams</span><span class='hs-varop'>.</span><span class='hs-conid'>Combinators</span> <span class='hs-layout'>(</span><span class='hs-varid'>withTrace</span><span class='hs-layout'>)</span>
<a name="line-37"></a>
<a name="line-38"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Linear</span><span class='hs-varop'>.</span><span class='hs-conid'>Metric</span>
<a name="line-39"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Linear</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span>
<a name="line-40"></a>
<a name="line-41"></a><a name="boundaryFrom"></a><span class='hs-comment'>-- | Compute the furthest point on the boundary of a subdiagram,</span>
<a name="line-42"></a><span class='hs-comment'>-- beginning from the location (local origin) of the subdiagram and</span>
<a name="line-43"></a><span class='hs-comment'>-- moving in the direction of the given vector. If there is no such</span>
<a name="line-44"></a><span class='hs-comment'>-- point, the origin is returned; see also 'boundaryFromMay'.</span>
<a name="line-45"></a><span class='hs-definition'>boundaryFrom</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>OrderedField</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Metric</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>Semigroup</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span>
<a name="line-46"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Subdiagram</span> <span class='hs-varid'>b</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Point</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span>
<a name="line-47"></a><span class='hs-definition'>boundaryFrom</span> <span class='hs-varid'>s</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromMaybe</span> <span class='hs-varid'>origin</span> <span class='hs-varop'>$</span> <span class='hs-varid'>boundaryFromMay</span> <span class='hs-varid'>s</span> <span class='hs-varid'>v</span>
<a name="line-48"></a>
<a name="line-49"></a><a name="boundaryFromMay"></a><span class='hs-comment'>-- | Compute the furthest point on the boundary of a subdiagram,</span>
<a name="line-50"></a><span class='hs-comment'>-- beginning from the location (local origin) of the subdiagram and</span>
<a name="line-51"></a><span class='hs-comment'>-- moving in the direction of the given vector, or @Nothing@ if</span>
<a name="line-52"></a><span class='hs-comment'>-- there is no such point.</span>
<a name="line-53"></a><span class='hs-definition'>boundaryFromMay</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Metric</span> <span class='hs-varid'>v</span><span class='hs-layout'>,</span> <span class='hs-conid'>OrderedField</span> <span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-conid'>Semigroup</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span>
<a name="line-54"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Subdiagram</span> <span class='hs-varid'>b</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>Point</span> <span class='hs-varid'>v</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span>
<a name="line-55"></a><span class='hs-definition'>boundaryFromMay</span> <span class='hs-varid'>s</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>traceP</span> <span class='hs-layout'>(</span><span class='hs-varid'>location</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>negated</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span>
<a name="line-56"></a>
</pre></body>
</html>
|