import Data.Maybe (isNothing)

safeHead :: [a] -> Maybe a
-- implement here

safeTail :: [a] -> Maybe [a]
-- implement here

safeLast :: [a] -> Maybe a
-- implement here

safeInit :: [a] -> Maybe [a]
-- implement here




-- Tests für safeHead
testSafeHead :: IO ()
testSafeHead = do
    print((safeHead [1,2,3]) == (Just 1))
    print(isNothing (safeHead [] :: Maybe [Int]))

-- Tests für safeTail
testSafeTail :: IO ()
testSafeTail = do
    print((safeTail [1,2,3]) == (Just [2,3]))   
    print (isNothing (safeTail [] :: Maybe [Int]))   

-- Tests für safeLast
testSafeLast :: IO ()
testSafeLast = do
    print((safeLast [1,2,3]) == (Just 3))
    print (isNothing (safeLast [] :: Maybe [Int]))

-- Tests für safeInit
testSafeInit :: IO ()
testSafeInit = do
    print((safeInit [1,2,3]) == (Just [1,2]))
    print (isNothing (safeInit [] :: Maybe [Int]))              

main :: IO ()
main = do
    putStrLn "Test 1: safeHead"
    testSafeHead
    putStrLn "Test 2: safeTail"
    testSafeTail
    putStrLn "Test 3: safeLast"
    testSafeLast
    putStrLn "Test 4: safeInit"
    testSafeInit