-
Notifications
You must be signed in to change notification settings - Fork 271
/
Data-Text-Lazy-Lens.html
51 lines (51 loc) · 4.6 KB
/
Data-Text-Lazy-Lens.html
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
<?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/Data/Text/Lazy/Lens.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE CPP #-}</span>
<a name="line-2"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-3"></a><span class='hs-comment'>{-# LANGUAGE FlexibleContexts #-}</span>
<a name="line-4"></a><span class='hs-cpp'>#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704</span>
<a name="line-5"></a><span class='hs-comment'>{-# LANGUAGE Trustworthy #-}</span>
<a name="line-6"></a><span class='hs-cpp'>#endif</span>
<a name="line-7"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-8"></a><span class='hs-comment'>-- |</span>
<a name="line-9"></a><span class='hs-comment'>-- Module : Data.Text.Lazy.Lens</span>
<a name="line-10"></a><span class='hs-comment'>-- Copyright : (C) 2012 Edward Kmett</span>
<a name="line-11"></a><span class='hs-comment'>-- License : BSD-style (see the file LICENSE)</span>
<a name="line-12"></a><span class='hs-comment'>-- Maintainer : Edward Kmett <ekmett@gmail.com></span>
<a name="line-13"></a><span class='hs-comment'>-- Stability : provisional</span>
<a name="line-14"></a><span class='hs-comment'>-- Portability : portable</span>
<a name="line-15"></a><span class='hs-comment'>--</span>
<a name="line-16"></a><span class='hs-comment'>----------------------------------------------------------------------------</span>
<a name="line-17"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Lazy</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span>
<a name="line-18"></a> <span class='hs-layout'>(</span> <span class='hs-varid'>packed</span>
<a name="line-19"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>text</span>
<a name="line-20"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-21"></a>
<a name="line-22"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span>
<a name="line-23"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Lazy</span>
<a name="line-24"></a>
<a name="line-25"></a><a name="packed"></a><span class='hs-comment'>-- | Pack (or unpack) lazy 'Text'.</span>
<a name="line-26"></a><span class='hs-comment'>--</span>
<a name="line-27"></a><span class='hs-comment'>-- @</span>
<a name="line-28"></a><span class='hs-comment'>-- 'pack' x = x '^.' 'packed'</span>
<a name="line-29"></a><span class='hs-comment'>-- 'unpack' x = x '^.' 'from' 'packed'</span>
<a name="line-30"></a><span class='hs-comment'>-- @</span>
<a name="line-31"></a><span class='hs-definition'>packed</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Simple</span> <span class='hs-conid'>Iso</span> <span class='hs-conid'>String</span> <span class='hs-conid'>Text</span>
<a name="line-32"></a><span class='hs-definition'>packed</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>iso</span> <span class='hs-varid'>pack</span> <span class='hs-varid'>unpack</span>
<a name="line-33"></a><span class='hs-comment'>{-# INLINE packed #-}</span>
<a name="line-34"></a>
<a name="line-35"></a><a name="text"></a><span class='hs-comment'>-- | Traverse the individual characters in a 'Text'.</span>
<a name="line-36"></a><span class='hs-comment'>--</span>
<a name="line-37"></a><span class='hs-comment'>-- > anyOf text (=='c') :: Text -> Bool</span>
<a name="line-38"></a><span class='hs-definition'>text</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SimpleIndexedTraversal</span> <span class='hs-conid'>Int</span> <span class='hs-conid'>Text</span> <span class='hs-conid'>Char</span>
<a name="line-39"></a><span class='hs-definition'>text</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>from</span> <span class='hs-varid'>packed</span> <span class='hs-varop'>.></span> <span class='hs-varid'>itraversed</span>
<a name="line-40"></a><span class='hs-comment'>{-# INLINE text #-}</span>
</pre></body>
</html>