Closed f7deleon closed 1 year ago
Oops thanks for catching that! Wouldn’t it be simpler to replace “non-empty” with “empty”?
On Sun, Mar 13, 2022 at 12:08 PM Felipe de León @.***> wrote:
In the following section:
Write down a specification for `null` such that `safeHead` is verified. Do *not* force `null` to only take non-empty inputs, that defeats the purpose. Instead, its type should say that it works on *all* lists and returns `True` *if and only if* the input is non-empty.\hint You may want to refresh your memory about implies
==>
and<=>
from the chapter on logic. \begin{code}safeHead :: [a] -> Maybe a safeHead xs | null xs = Nothing | otherwise = Just $ head xs{-@ null :: [a] -> Bool @-}null [] = Truenull (:) = False\end{code}
I think that "all list and return True" should be "all list and returns False" given the current definition of null
You can view, comment on, or merge this pull request online at:
https://github.com/ucsd-progsys/liquidhaskell-tutorial/pull/118 https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ucsd-2Dprogsys_liquidhaskell-2Dtutorial_pull_118&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=Uo-hEzxUqawAIQcPQsdKEQNVVlIZ6WO9Si1ieIV634A&e= Commit Summary
File Changes
Patch Links:
- https://github.com/ucsd-progsys/liquidhaskell-tutorial/pull/118.patch https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ucsd-2Dprogsys_liquidhaskell-2Dtutorial_pull_118.patch&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=ydISXU4--1LH1tsF2lYjL0nG0ToBajwRMv-DMRfcze0&e=
- https://github.com/ucsd-progsys/liquidhaskell-tutorial/pull/118.diff https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ucsd-2Dprogsys_liquidhaskell-2Dtutorial_pull_118.diff&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=kAgEsC3p0-wUtuQQmwcF7R88Su51fy00Mf8LuYOUxT8&e=
— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ucsd-2Dprogsys_liquidhaskell-2Dtutorial_pull_118&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=Uo-hEzxUqawAIQcPQsdKEQNVVlIZ6WO9Si1ieIV634A&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAMS4OAHW3HKB44U3U3KR43U7Y4MDANCNFSM5QTXANHQ&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=6WVXhYefx9L3i-fClw8zGOdptZjj5cdXt4lVxtDCdHc&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=IwqM5esAuVA_7XzXz2WQS0w53YlXBQWuguT9YdXzSJ0&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=_iNsePBRcSxdR3sI4PVJYa4PWLfUJOHWmPPTkiSwhbLizLCxxEKPYhRgWgYZ7QL0&s=WPy5XQHh-aM63FmpeQw8ShOeDU-4Vi6YC2N6ebREuOE&e=.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
In the following section:
I think that "all list and return True" should be "all list and returns False" given the current definition of null