How to use exponents in PureScript

I'm doing the exercises for PureScript By Example and I needed to raise a number to a power. (exponentiate: to use an exponent). This was not obvious to me. A couple of hints:

  1. Remember that JavaScript uses Math.pow^ is a bitwise XOR operator that has nothing to do with exponentiation.

  2. Use Pursuit to search for Pow. ... Wow, that's a lot of options. It really depends on the type you want to exponentiate. How about a simple Number? It's actually the fourth one in the list. Math.pow

Here's how to use it:

import Math (pow)  
pow 2.0 4.0  
-> 16

Ivan Storck

Web Developer, Teacher, Entrepreneur. Co-founder of Sustainable Websites, Code Fellows, and Aerobatic. Ivan lives in Seattle and enjoys paddling his SUP, spending time with family, and traveling.