From: Camil Staps Date: Tue, 1 Nov 2016 21:07:15 +0000 (+0100) Subject: Use Data.Maybe Maybe for compatibility X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=59bae2bb34904a71ba319cecb47af322c65f1f73;p=CleanReadLine.git Use Data.Maybe Maybe for compatibility --- diff --git a/Makefile b/Makefile index e3cfbd2..32b7372 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CLM:=clm -CLMFLAGS:=-nt -l -lreadline +CLMFLAGS:=-nt -l -lreadline -I $$CLEAN_HOME/lib/clean-platform/OS-Independent -I $$CLEAN_HOME/lib/Generics LIBRARYDIR:=Clean\ System\ Files BINARIES:=test diff --git a/ReadLine.dcl b/ReadLine.dcl index e93bbc1..222f949 100644 --- a/ReadLine.dcl +++ b/ReadLine.dcl @@ -1,19 +1,14 @@ definition module ReadLine import StdClass +from Data.Maybe import :: Maybe -:: Maybe a = Nothing | Just a :: HistoryItem = {line :: String, timestamp :: String} :: HistoryState = {entries :: [HistoryItem], offset :: Int, flags :: Int} instance toString HistoryItem instance toString HistoryState -//Maybe functions -isNothing :: !(Maybe .x) -> Bool -isJust :: !(Maybe .x) -> Bool -fromJust :: !(Maybe .x) -> .x - //Non-library functions setReadLineName :: !String !*env -> *env diff --git a/ReadLine.icl b/ReadLine.icl index fa23473..4d15493 100644 --- a/ReadLine.icl +++ b/ReadLine.icl @@ -1,21 +1,10 @@ implementation module ReadLine import StdEnv +import Data.Maybe import code from "readLine.o" -//Maybe -isNothing :: !(Maybe .x) -> Bool -isNothing Nothing = True -isNothing _ = False - -isJust :: !(Maybe .x) -> Bool -isJust Nothing = False -isJust _ = True - -fromJust :: !(Maybe .x) -> .x -fromJust (Just x) = x - instance toString HistoryItem where toString {line,timestamp} = line +++ " (" +++ timestamp +++ ")" instance toString HistoryState where