/usr/share/doc/libghc-chasingbottoms-doc/html/src/Test-ChasingBottoms-IsType.html is in libghc-chasingbottoms-doc 1.3.1.3-1build1.
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 | <?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>Test/ChasingBottoms/IsType.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- |</span>
<a name="line-2"></a><span class='hs-comment'>-- Module : Test.ChasingBottoms.IsType</span>
<a name="line-3"></a><span class='hs-comment'>-- Copyright : (c) Nils Anders Danielsson 2004-2017</span>
<a name="line-4"></a><span class='hs-comment'>-- License : See the file LICENCE.</span>
<a name="line-5"></a><span class='hs-comment'>--</span>
<a name="line-6"></a><span class='hs-comment'>-- Maintainer : <a href="http://www.cse.chalmers.se/~nad/">http://www.cse.chalmers.se/~nad/</a></span>
<a name="line-7"></a><span class='hs-comment'>-- Stability : experimental</span>
<a name="line-8"></a><span class='hs-comment'>-- Portability : non-portable (GHC-specific)</span>
<a name="line-9"></a><span class='hs-comment'>--</span>
<a name="line-10"></a><span class='hs-comment'>-- Internal helper functions.</span>
<a name="line-11"></a>
<a name="line-12"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Test</span><span class='hs-varop'>.</span><span class='hs-conid'>ChasingBottoms</span><span class='hs-varop'>.</span><span class='hs-conid'>IsType</span>
<a name="line-13"></a> <span class='hs-layout'>(</span> <span class='hs-varid'>isFunction</span>
<a name="line-14"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isTuple</span>
<a name="line-15"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isList</span>
<a name="line-16"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isString</span>
<a name="line-17"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-18"></a>
<a name="line-19"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span>
<a name="line-20"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Typeable</span>
<a name="line-21"></a>
<a name="line-22"></a><a name="isFunction"></a><span class='hs-comment'>-- | '@isFunction@ f' returns 'True' iff the top level \"constructor\"</span>
<a name="line-23"></a><span class='hs-comment'>-- of @f@ is a function arrow.</span>
<a name="line-24"></a><span class='hs-definition'>isFunction</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Typeable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-25"></a><span class='hs-definition'>isFunction</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>con</span> <span class='hs-varid'>f</span> <span class='hs-varop'>==</span> <span class='hs-varid'>con</span> <span class='hs-varid'>not</span> <span class='hs-comment'>-- TyCon is abstract.</span>
<a name="line-26"></a>
<a name="line-27"></a><a name="con"></a><span class='hs-definition'>con</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Typeable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>TyCon</span>
<a name="line-28"></a><span class='hs-definition'>con</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>typeRepTyCon</span> <span class='hs-varop'>.</span> <span class='hs-varid'>typeOf</span>
<a name="line-29"></a>
<a name="line-30"></a><a name="isTuple"></a><span class='hs-comment'>-- | This function is rather fragile, but should be OK. It is only</span>
<a name="line-31"></a><span class='hs-comment'>-- used by "Test.ChasingBottoms.ApproxShow", which should only be used</span>
<a name="line-32"></a><span class='hs-comment'>-- for debugging purposes anyway. The unit type is not considered to</span>
<a name="line-33"></a><span class='hs-comment'>-- be a tuple.</span>
<a name="line-34"></a><span class='hs-definition'>isTuple</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Typeable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-35"></a><span class='hs-definition'>isTuple</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"(,"</span> <span class='hs-varop'>`isPrefixOf`</span> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>con</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-36"></a>
<a name="line-37"></a><a name="isString"></a><span class='hs-definition'>isString</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Typeable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-38"></a><span class='hs-definition'>isString</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>isList</span> <span class='hs-varid'>x</span> <span class='hs-varop'>&&</span> <span class='hs-varid'>typeRepArgs</span> <span class='hs-layout'>(</span><span class='hs-varid'>typeOf</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span> <span class='hs-varop'>==</span> <span class='hs-varid'>typeRepArgs</span> <span class='hs-layout'>(</span><span class='hs-varid'>typeOf</span> <span class='hs-str'>""</span><span class='hs-layout'>)</span>
<a name="line-39"></a>
<a name="line-40"></a><a name="isList"></a><span class='hs-definition'>isList</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Typeable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-41"></a><span class='hs-definition'>isList</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>con</span> <span class='hs-varid'>x</span> <span class='hs-varop'>==</span> <span class='hs-varid'>con</span> <span class='hs-str'>""</span>
</pre></body>
</html>
|