Project Inquiry

Implement Prelude.uncurry

Challenge
{-# LANGUAGE NoImplicitPrelude #-}

module Main where

import           Prelude hiding (uncurry)

main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"

test :: Bool
test = uncurry helper (42, 42) == 84
  where helper :: Integer -> Integer -> Integer
        helper fstParam sndParam = fstParam + sndParam

-- TODO
uncurry :: (a -> b -> c) -> (a, b) -> c
uncurry = undefined
Solution
{-# LANGUAGE NoImplicitPrelude #-}

module Main where

import           Prelude hiding (uncurry)

main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"

test :: Bool
test = uncurry helper (42, 42) == 84
  where helper :: Integer -> Integer -> Integer
        helper fstParam sndParam = fstParam + sndParam

-- DONE
uncurry :: (a -> b -> c) -> (a, b) -> c
uncurry f (fstParam, sndParam) = f fstParam sndParam