<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=RU link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-GB>import Prelude hiding ((^))<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>See here: <a href="https://wiki.haskell.org/Import">https://wiki.haskell.org/Import</a><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-GB>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Paul<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>От: </b><a href="mailto:trent.shipley@gmail.com">trent shipley</a><br><b>Отправлено: </b>3 марта 2018 г. в 8:25<br><b>Кому: </b><a href="mailto:beginners@haskell.org">beginners@haskell.org</a><br><b>Тема: </b>[Haskell-beginners] Overload ^</p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>{-</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I want to override Prelude.^ (as an academic exercise).</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Can it be done? How?</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Trent</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>-}</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>(^) :: Int -> Int -> Int</p></div><div><p class=MsoNormal>m ^ 0 = 1 </p></div><div><p class=MsoNormal>m ^ n = m * (m ^ (n-1))</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>{-</p></div><div><p class=MsoNormal>Hutton, Graham. Programming in Haskell (p. 263). Cambridge University Press. Kindle Edition. 2016.</p></div><div><p class=MsoNormal>-}</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>{-</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Result</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>[1 of 1] Compiling Main ( ex6_3b.hs, interpreted )</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>ex6_3b.hs:3:16: error:</p></div><div><p class=MsoNormal> Ambiguous occurrence ‘^’</p></div><div><p class=MsoNormal> It could refer to either ‘Prelude.^’,</p></div><div><p class=MsoNormal> imported from ‘Prelude’ at ex6_3b.hs:1:1</p></div><div><p class=MsoNormal> (and originally defined in ‘GHC.Real’)</p></div><div><p class=MsoNormal> or ‘Main.^’, defined at ex6_3b.hs:2:3</p></div><div><p class=MsoNormal> |</p></div><div><p class=MsoNormal>3 | m ^ n = m * (m ^ (n-1)) | ^</p></div><div><p class=MsoNormal>Failed, no modules loaded.</p></div><div><p class=MsoNormal>-}</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>-- So I try</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>(^) :: Int -> Int -> Int</p></div><div><p class=MsoNormal>m Main.^ 0 = 1 </p></div><div><p class=MsoNormal>m Main.^ n = m * (m Main.^ (n-1))</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>{-</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Result</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Prelude> :reload</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>ex6_3b.hs:2:3: error: Qualified name in binding position: Main.^</p></div><div><p class=MsoNormal> |</p></div><div><p class=MsoNormal>2 | m Main.^ 0 = 1 | ^^^^^^</p></div><div><p class=MsoNormal>[1 of 1] Compiling Main ( ex6_3b.hs, interpreted )</p></div><div><p class=MsoNormal>Failed, no modules loaded.</p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal>-}</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>