Insertion sort in Haskell
is calling insert with three arguments (x,insertionSort,xs). Probably you want
is calling insert with three arguments (x,insertionSort,xs). Probably you want
There are a few small issues. ifelse is a vectorized function, but you just need a simple if. In fact, you don’t really need an else — you could just throw an error immediately if the data set does not exist. Note that your error message is not using the name of the object, so it will create its own … Read more
I understand what most of this means apart from Cons. When I try :t Cons and :i Cons in ghci I get a not in scope error. You need to load the Haskell source file with the data declaration before you can have Cons in scope. Or, alternatively, you can enter that data line directly in GHCi. For serious code, it’s easier if you put it in … Read more