From b6c1c2722447019ad2eea2c11a114fa000cae54b Mon Sep 17 00:00:00 2001 From: Johannes Merl Date: Mon, 19 Feb 2024 21:56:28 +0100 Subject: [PATCH] WIP: lambda Individuuen --- haga.cabal | 6 ++++++ src/GA.hs | 2 +- src/Main.hs | 4 ++-- src/Test.hs | 16 ++++++++++++++++ stack.yaml | 2 +- stack.yaml.lock | 8 ++++---- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/haga.cabal b/haga.cabal index 196fc8a..a402668 100644 --- a/haga.cabal +++ b/haga.cabal @@ -22,6 +22,7 @@ build-type: Simple library build-depends: base , cassava + , containers , extra , MonadRandom , monad-loops @@ -44,10 +45,12 @@ library , Seminar , Pretty , Szenario191 + , LambdaCalculus executable haga build-depends: base , cassava + , containers , extra , MonadRandom , monad-loops @@ -71,10 +74,12 @@ executable haga , Seminar , Pretty , Szenario191 + , LambdaCalculus executable haga-test build-depends: base , cassava + , containers , Cabal , extra , MonadRandom @@ -99,3 +104,4 @@ executable haga-test , Seminar , Pretty , Szenario191 + , LambdaCalculus diff --git a/src/GA.hs b/src/GA.hs index 2dd423f..552d79f 100644 --- a/src/GA.hs +++ b/src/GA.hs @@ -19,7 +19,7 @@ -- In order to use it for a certain problem, basically, you have to make your -- solution type an instance of 'Individual' and then simply call the 'run' -- function. -module GA where +module GA ( Environment,new, population, mutate, crossover1,crossover, Evaluator, fitness, Individual, GA.run, tournament, N, R, Population, steps, bests, runTests) where import Control.Arrow hiding (first, second) import Data.List.NonEmpty ((<|)) diff --git a/src/Main.hs b/src/Main.hs index ce53a67..a3cf242 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -11,8 +11,8 @@ import System.IO import Szenario191 data Options = Options - { iterations :: N, - populationSize :: N + { iterations :: !N, + populationSize :: !N } options :: Parser Options diff --git a/src/Test.hs b/src/Test.hs index a7fbe27..ab82005 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -1,13 +1,29 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE NoImplicitPrelude #-} module Main where import qualified GA import Protolude import qualified Seminar +import qualified LambdaCalculus +import Data.Typeable +import qualified Type.Reflection as Ref main :: IO () main = do _ <- GA.runTests _ <- Seminar.runTests + _ <- putStrLn $ ((show (typeRepArgs (Ref.SomeTypeRep (Ref.TypeRep @(Int->Int->Int->Text))))) :: Text) + _ <- putStrLn $ ((show (typeRepArgs (Ref.SomeTypeRep (Ref.TypeRep @(Text))))) :: Text) + _ <- putStrLn (LambdaCalculus.toLambdaExpressionShort LambdaCalculus.testIntToClassCorrect) + _ <- putStrLn $ ((show (LambdaCalculus.res 1)) :: Text) + _ <- putStrLn $ ((show (LambdaCalculus.res 2)) :: Text) + _ <- putStrLn $ ((show (LambdaCalculus.res 3)) :: Text) return () diff --git a/stack.yaml b/stack.yaml index 1fa8a79..07388ee 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,7 @@ # # resolver: ./custom-snapshot.yaml # resolver: https://example.com/snapshots/2023-01-01.yaml -resolver: lts-21.25 +resolver: nightly-2024-02-11 # User packages to be built. # Various formats can be used as shown in the example below. diff --git a/stack.yaml.lock b/stack.yaml.lock index f823d29..d1fc4aa 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - sha256: a81fb3877c4f9031e1325eb3935122e608d80715dc16b586eb11ddbff8671ecd - size: 640086 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/25.yaml - original: lts-21.25 + sha256: 3693cc17b3c739a22032b7c7bf44aa7ddbeef79311bb9f175e68372f92fc749b + size: 600684 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2024/2/11.yaml + original: nightly-2024-02-11