<p>Theres is a little problem I want to solve with Haskell:
let substitute a function that change all of the wildcards in a string for one concrete parameter. The function has de signature of:</p>

<pre><code>subs :: String -&gt; String -&gt; String -&gt; String
-- example:
-- subs 'x' "x^3 + x + sin(x)" "6.2" will generate
--          "6.2^3 + 6.2 + sin(6.2)"
</code></pre>

[{'answer_id': 65479, 'author': 'Dan Dyer', 'author_id': 5171, 'author_profile': 'https://Stackoverflow.com/users/5171', 'pm_score': 4, 'selected': True, 'text': '<p>You could use the <a href="http://hackage.haskell.org/package/regex-compat-0.95.1" rel="nofollow noreferrer">Text.Regex</a> package.</p>\n\n<p>Your example might look something like this:</p>\n\n<pre><code>import Text.Regex(mkRegex, subRegex)\n\nsubs :: String -&gt; String -&gt; String -&gt; String\nsubs wildcard input value = subRegex (mkRegex wildcard) input value\n</code></pre>\n'}, {'answer_id': 65501, 'author': 'jrudolph', 'author_id': 7647, 'author_profile': 'https://Stackoverflow.com/users/7647', 'pm_score': 2, 'selected': False, 'text': '<p>See <a href="http://bluebones.net/2007/01/replace-in-haskell/" rel="nofollow noreferrer">http://bluebones.net/2007/01/replace-in-haskell/</a> for an example which looks exactly as the piece of code you are looking for.</p>\n'}, {'answer_id': 65520, 'author': 'squadette', 'author_id': 7754, 'author_profile': 'https://Stackoverflow.com/users/7754', 'pm_score': 1, 'selected': False, 'text': '<p>Use regular expressions (<code>Text.Regex.Posix</code>) and search-replace for <code>/\\Wx\\W/</code> (Perl notation).  Simply replacing <code>x</code> to <code>6.2</code> will bring you trouble with <code>x + quux</code>.</p>\n\n<p><a href="http://lukeplant.me.uk/blog.php?id=1107301690" rel="nofollow noreferrer">Haskell Regex Replace</a> for more information (I think this should be imported to SO.</p>\n\n<p>For extra hard-core you could parse your expression as AST and do the replacement on that level.  </p>\n'}, {'answer_id': 7175000, 'author': 'Dmitry Bespalov', 'author_id': 905914, 'author_profile': 'https://Stackoverflow.com/users/905914', 'pm_score': 2, 'selected': False, 'text': '<p>You can use <strong>text-format-simple</strong> library for such cases:</p>\n\n<pre><code>import Text.Format\nformat "{0}^3 + {0} + sin({0})" ["6.2"]\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/64693', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6766/']