I'm passing around a partially applied function. The full signature is:
import Data.Map as Map
-- Update the correct bin of the histogram based on the min value, bin width,
-- the histogram stored as a map, and the actual value we are interested in.
updateHist :: Double -> Double -> Map.Map Bin Double -> Double ->
Map.Map Bin Double
The function updates a Map which stores data for a histogram. The first two parameters give the bottom bounds of data we are interested, the next is the bin width for the histogram. I fill these values in when the program starts up and pass the partially applied function all over the module. This means I have a ton of functions with a signature like:
-- Extra the data out of the string and update the histogram (in the Map) with it.
doSomething :: String -> (Map.Map Bin Double -> Double -> Map.Map Bin Double) ->
Map.Map Bin Double
This is all fine and dandy, but writing "(Map.Map Bin Double -> Double -> Map.Map Bin Double)" is rather verbose. I'd like to replace them all with "UpdateHistFunc" as a type but for some reason I keep failing.
I tried:
newtype UpdateHistFunc = Map.Map Bin Double -> Double -> Map.Map Bin Double
This failed with the error:
HistogramForColumn.hs:84:44: parse error on input `->'
What am I doing wrong?