Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/haskell
File: index.html
<!doctype html>
[0] Fix | Delete
[1] Fix | Delete
<title>CodeMirror: Haskell mode</title>
[2] Fix | Delete
<meta charset="utf-8"/>
[3] Fix | Delete
<link rel=stylesheet href="../../doc/docs.css">
[4] Fix | Delete
[5] Fix | Delete
<link rel="stylesheet" href="../../lib/codemirror.css">
[6] Fix | Delete
<link rel="stylesheet" href="../../theme/elegant.css">
[7] Fix | Delete
<script src="../../lib/codemirror.js"></script>
[8] Fix | Delete
<script src="../../addon/edit/matchbrackets.js"></script>
[9] Fix | Delete
<script src="haskell.js"></script>
[10] Fix | Delete
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
[11] Fix | Delete
<div id=nav>
[12] Fix | Delete
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
[13] Fix | Delete
[14] Fix | Delete
<ul>
[15] Fix | Delete
<li><a href="../../index.html">Home</a>
[16] Fix | Delete
<li><a href="../../doc/manual.html">Manual</a>
[17] Fix | Delete
<li><a href="https://github.com/codemirror/codemirror">Code</a>
[18] Fix | Delete
</ul>
[19] Fix | Delete
<ul>
[20] Fix | Delete
<li><a href="../index.html">Language modes</a>
[21] Fix | Delete
<li><a class=active href="#">Haskell</a>
[22] Fix | Delete
</ul>
[23] Fix | Delete
</div>
[24] Fix | Delete
[25] Fix | Delete
<article>
[26] Fix | Delete
<h2>Haskell mode</h2>
[27] Fix | Delete
<form><textarea id="code" name="code">
[28] Fix | Delete
module UniquePerms (
[29] Fix | Delete
uniquePerms
[30] Fix | Delete
)
[31] Fix | Delete
where
[32] Fix | Delete
[33] Fix | Delete
-- | Find all unique permutations of a list where there might be duplicates.
[34] Fix | Delete
uniquePerms :: (Eq a) => [a] -> [[a]]
[35] Fix | Delete
uniquePerms = permBag . makeBag
[36] Fix | Delete
[37] Fix | Delete
-- | An unordered collection where duplicate values are allowed,
[38] Fix | Delete
-- but represented with a single value and a count.
[39] Fix | Delete
type Bag a = [(a, Int)]
[40] Fix | Delete
[41] Fix | Delete
makeBag :: (Eq a) => [a] -> Bag a
[42] Fix | Delete
makeBag [] = []
[43] Fix | Delete
makeBag (a:as) = mix a $ makeBag as
[44] Fix | Delete
where
[45] Fix | Delete
mix a [] = [(a,1)]
[46] Fix | Delete
mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
[47] Fix | Delete
| otherwise = bn : mix a bs
[48] Fix | Delete
[49] Fix | Delete
permBag :: Bag a -> [[a]]
[50] Fix | Delete
permBag [] = [[]]
[51] Fix | Delete
permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
[52] Fix | Delete
where
[53] Fix | Delete
oneOfEach [] = []
[54] Fix | Delete
oneOfEach (an@(a,n):bs) =
[55] Fix | Delete
let bs' = if n == 1 then bs else (a,n-1):bs
[56] Fix | Delete
in (a,bs') : mapSnd (an:) (oneOfEach bs)
[57] Fix | Delete
[58] Fix | Delete
apSnd f (a,b) = (a, f b)
[59] Fix | Delete
mapSnd = map . apSnd
[60] Fix | Delete
</textarea></form>
[61] Fix | Delete
[62] Fix | Delete
<script>
[63] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
[64] Fix | Delete
lineNumbers: true,
[65] Fix | Delete
matchBrackets: true,
[66] Fix | Delete
theme: "elegant"
[67] Fix | Delete
});
[68] Fix | Delete
</script>
[69] Fix | Delete
[70] Fix | Delete
<p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
[71] Fix | Delete
</article>
[72] Fix | Delete
[73] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function