diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/Paths_huffman.hs b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/Paths_huffman.hs index 3025ce5..33320e6 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/Paths_huffman.hs +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/Paths_huffman.hs @@ -43,7 +43,7 @@ getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/bin" -libdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-5hb8DvQH04kAhx22YvzXdK" +libdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt" dynlibdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7" datadir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/share/x86_64-linux-ghc-9.4.7/huffman-0.1" libexecdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/libexec/x86_64-linux-ghc-9.4.7/huffman-0.1" diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/cabal_macros.h b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/cabal_macros.h index 44e9d38..701a700 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/cabal_macros.h +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/autogen/cabal_macros.h @@ -153,10 +153,10 @@ #endif /* MIN_TOOL_VERSION_strip */ #ifndef CURRENT_PACKAGE_KEY -#define CURRENT_PACKAGE_KEY "huffman-0.1-5hb8DvQH04kAhx22YvzXdK" +#define CURRENT_PACKAGE_KEY "huffman-0.1-FYSjga9JLF2kZjOZ6zeLt" #endif /* CURRENT_packageKey */ #ifndef CURRENT_COMPONENT_ID -#define CURRENT_COMPONENT_ID "huffman-0.1-5hb8DvQH04kAhx22YvzXdK" +#define CURRENT_COMPONENT_ID "huffman-0.1-FYSjga9JLF2kZjOZ6zeLt" #endif /* CURRENT_COMPONENT_ID */ #ifndef CURRENT_PACKAGE_VERSION #define CURRENT_PACKAGE_VERSION "0.1" diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/Paths_huffman.hs b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/Paths_huffman.hs index 4cfd52f..c21d7fe 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/Paths_huffman.hs +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/Paths_huffman.hs @@ -43,7 +43,7 @@ getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/bin" -libdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-7oGsPwnMV4MIdxe92R26Zp-huffman-exe" +libdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-23WUwl30C5UEHpdRSzT9lV-huffman-exe" dynlibdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/lib/x86_64-linux-ghc-9.4.7" datadir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/share/x86_64-linux-ghc-9.4.7/huffman-0.1" libexecdir = "/home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/.stack-work/install/x86_64-linux-tinfo6/bb0f3fab2049fedb4cba85d10a24b16a5e25afd3bd9adda8ddc0b2b676ff0e27/9.4.7/libexec/x86_64-linux-ghc-9.4.7/huffman-0.1" diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/cabal_macros.h b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/cabal_macros.h index 730a8a5..8e5225e 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/cabal_macros.h +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/build/huffman-exe/autogen/cabal_macros.h @@ -123,7 +123,7 @@ #endif /* MIN_TOOL_VERSION_strip */ #ifndef CURRENT_COMPONENT_ID -#define CURRENT_COMPONENT_ID "huffman-0.1-7oGsPwnMV4MIdxe92R26Zp-huffman-exe" +#define CURRENT_COMPONENT_ID "huffman-0.1-23WUwl30C5UEHpdRSzT9lV-huffman-exe" #endif /* CURRENT_COMPONENT_ID */ #ifndef CURRENT_PACKAGE_VERSION #define CURRENT_PACKAGE_VERSION "0.1" diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/setup-config b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/setup-config index 611545b..295f4b2 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/setup-config and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux-tinfo6/ghc-9.4.7/setup-config differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_hi b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_hi index 34bdd9b..1a5d656 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_hi and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_hi differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_o b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_o index 6478b9f..1cc50cb 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_o and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.dyn_o differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.hi b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.hi index 31f8184..ce9acb0 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.hi and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.hi differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.o b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.o index 7191755..7e59261 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.o and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/Huffman.o differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so index 7a1225f..bf6b246 100755 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a index ed1d44a..5fea785 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests index b723965..96051fc 100755 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.hi b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.hi index 4412aed..fc1ed3c 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.hi and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.hi differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.o b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.o index 9e75721..da62e59 100644 Binary files a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.o and b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/build/unit-tests/unit-tests-tmp/Main.o differ diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/lib b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/lib index fade27d..e334d46 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/lib +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/lib @@ -11,6 +11,6 @@ /home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/src/Auxiliaries.hs: hash: 5a404af397ad51d6d268ac0a318157dd9511d113c3fbfce35cc238d42974425f /home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/src/Huffman.hs: - hash: d08ec104d6db27dc13b5222e3c828e0c3ba8b0074350a3d0ffb298a0d7bd78b1 + hash: c379eba92ecb90bbd210add96734d89b196535d973d68cbdb8f9c7195284211f /usr/include/stdc-predef.h: hash: d6bcc58441a423bbb3a52171fcd3b84d8b36e332a55221a1c3e6e899bc43ccb3 diff --git a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/test-unit-tests b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/test-unit-tests index cf88a31..5f7653f 100644 --- a/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/test-unit-tests +++ b/Aufgabe_6/code/.stack-work/dist/x86_64-linux/ghc-9.4.7/stack-build-caches/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/test-unit-tests @@ -9,6 +9,6 @@ /home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/package.yaml: hash: e9fcddf7857388c0e51188152e25a1d446e2e46628ed45552bdc3b635472171c /home/a/Documents/Repositories/Anwendungsentwicklung_Haskell/Aufgabe_6/code/test/Tests.hs: - hash: 3ca5e27b2088e7a3ceff11746da999127e42a43fcb9431650eca06c193634c15 + hash: d146588effdec1312dbcdc1609a1293ad40f1b8f14cea6b19181cbfa13e499cc /usr/include/stdc-predef.h: hash: d6bcc58441a423bbb3a52171fcd3b84d8b36e332a55221a1c3e6e899bc43ccb3 diff --git a/Aufgabe_6/code/.stack-work/ghci/83dde5c4/cabal_macros.h b/Aufgabe_6/code/.stack-work/ghci/83dde5c4/cabal_macros.h new file mode 100644 index 0000000..da0cd84 --- /dev/null +++ b/Aufgabe_6/code/.stack-work/ghci/83dde5c4/cabal_macros.h @@ -0,0 +1,299 @@ +/* DO NOT EDIT: This file is automatically generated by Cabal */ + +/* package huffman-0.1 */ +#ifndef VERSION_huffman +#define VERSION_huffman "0.1" +#endif /* VERSION_huffman */ +#ifndef MIN_VERSION_huffman +#define MIN_VERSION_huffman(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 1 || \ + (major1) == 0 && (major2) == 1 && (minor) <= 0) +#endif /* MIN_VERSION_huffman */ +/* package base-4.17.2.0 */ +#ifndef VERSION_base +#define VERSION_base "4.17.2.0" +#endif /* VERSION_base */ +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) (\ + (major1) < 4 || \ + (major1) == 4 && (major2) < 17 || \ + (major1) == 4 && (major2) == 17 && (minor) <= 2) +#endif /* MIN_VERSION_base */ +/* package binary-0.8.9.1 */ +#ifndef VERSION_binary +#define VERSION_binary "0.8.9.1" +#endif /* VERSION_binary */ +#ifndef MIN_VERSION_binary +#define MIN_VERSION_binary(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 8 || \ + (major1) == 0 && (major2) == 8 && (minor) <= 9) +#endif /* MIN_VERSION_binary */ +/* package bytestring-0.11.5.2 */ +#ifndef VERSION_bytestring +#define VERSION_bytestring "0.11.5.2" +#endif /* VERSION_bytestring */ +#ifndef MIN_VERSION_bytestring +#define MIN_VERSION_bytestring(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 11 || \ + (major1) == 0 && (major2) == 11 && (minor) <= 5) +#endif /* MIN_VERSION_bytestring */ +/* package containers-0.6.7 */ +#ifndef VERSION_containers +#define VERSION_containers "0.6.7" +#endif /* VERSION_containers */ +#ifndef MIN_VERSION_containers +#define MIN_VERSION_containers(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 6 || \ + (major1) == 0 && (major2) == 6 && (minor) <= 7) +#endif /* MIN_VERSION_containers */ +/* package filepath-1.4.2.2 */ +#ifndef VERSION_filepath +#define VERSION_filepath "1.4.2.2" +#endif /* VERSION_filepath */ +#ifndef MIN_VERSION_filepath +#define MIN_VERSION_filepath(major1,major2,minor) (\ + (major1) < 1 || \ + (major1) == 1 && (major2) < 4 || \ + (major1) == 1 && (major2) == 4 && (minor) <= 2) +#endif /* MIN_VERSION_filepath */ + +/* tool gcc-13.2.0 */ +#ifndef TOOL_VERSION_gcc +#define TOOL_VERSION_gcc "13.2.0" +#endif /* TOOL_VERSION_gcc */ +#ifndef MIN_TOOL_VERSION_gcc +#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\ + (major1) < 13 || \ + (major1) == 13 && (major2) < 2 || \ + (major1) == 13 && (major2) == 2 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_gcc */ +/* tool ghc-9.4.7 */ +#ifndef TOOL_VERSION_ghc +#define TOOL_VERSION_ghc "9.4.7" +#endif /* TOOL_VERSION_ghc */ +#ifndef MIN_TOOL_VERSION_ghc +#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_ghc */ +/* tool ghc-pkg-9.4.7 */ +#ifndef TOOL_VERSION_ghc_pkg +#define TOOL_VERSION_ghc_pkg "9.4.7" +#endif /* TOOL_VERSION_ghc_pkg */ +#ifndef MIN_TOOL_VERSION_ghc_pkg +#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_ghc_pkg */ +/* tool haddock-2.27.0 */ +#ifndef TOOL_VERSION_haddock +#define TOOL_VERSION_haddock "2.27.0" +#endif /* TOOL_VERSION_haddock */ +#ifndef MIN_TOOL_VERSION_haddock +#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 27 || \ + (major1) == 2 && (major2) == 27 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_haddock */ +/* tool hpc-0.68 */ +#ifndef TOOL_VERSION_hpc +#define TOOL_VERSION_hpc "0.68" +#endif /* TOOL_VERSION_hpc */ +#ifndef MIN_TOOL_VERSION_hpc +#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 68 || \ + (major1) == 0 && (major2) == 68 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_hpc */ +/* tool hsc2hs-0.68.8 */ +#ifndef TOOL_VERSION_hsc2hs +#define TOOL_VERSION_hsc2hs "0.68.8" +#endif /* TOOL_VERSION_hsc2hs */ +#ifndef MIN_TOOL_VERSION_hsc2hs +#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 68 || \ + (major1) == 0 && (major2) == 68 && (minor) <= 8) +#endif /* MIN_TOOL_VERSION_hsc2hs */ +/* tool pkg-config-2.0.2 */ +#ifndef TOOL_VERSION_pkg_config +#define TOOL_VERSION_pkg_config "2.0.2" +#endif /* TOOL_VERSION_pkg_config */ +#ifndef MIN_TOOL_VERSION_pkg_config +#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 0 || \ + (major1) == 2 && (major2) == 0 && (minor) <= 2) +#endif /* MIN_TOOL_VERSION_pkg_config */ +/* tool runghc-9.4.7 */ +#ifndef TOOL_VERSION_runghc +#define TOOL_VERSION_runghc "9.4.7" +#endif /* TOOL_VERSION_runghc */ +#ifndef MIN_TOOL_VERSION_runghc +#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_runghc */ +/* tool strip-2.41 */ +#ifndef TOOL_VERSION_strip +#define TOOL_VERSION_strip "2.41" +#endif /* TOOL_VERSION_strip */ +#ifndef MIN_TOOL_VERSION_strip +#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 41 || \ + (major1) == 2 && (major2) == 41 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_strip */ + +#ifndef CURRENT_PACKAGE_KEY +#define CURRENT_PACKAGE_KEY "huffman-0.1-5hb8DvQH04kAhx22YvzXdK" +#endif /* CURRENT_packageKey */ +#ifndef CURRENT_COMPONENT_ID +#define CURRENT_COMPONENT_ID "huffman-0.1-5hb8DvQH04kAhx22YvzXdK" +#endif /* CURRENT_COMPONENT_ID */ +#ifndef CURRENT_PACKAGE_VERSION +#define CURRENT_PACKAGE_VERSION "0.1" +#endif /* CURRENT_PACKAGE_VERSION */ + +#undef CURRENT_PACKAGE_KEY +#undef CURRENT_COMPONENT_ID +/* DO NOT EDIT: This file is automatically generated by Cabal */ + +/* package huffman-0.1 */ +#ifndef VERSION_huffman +#define VERSION_huffman "0.1" +#endif /* VERSION_huffman */ +#ifndef MIN_VERSION_huffman +#define MIN_VERSION_huffman(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 1 || \ + (major1) == 0 && (major2) == 1 && (minor) <= 0) +#endif /* MIN_VERSION_huffman */ +/* package base-4.17.2.0 */ +#ifndef VERSION_base +#define VERSION_base "4.17.2.0" +#endif /* VERSION_base */ +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) (\ + (major1) < 4 || \ + (major1) == 4 && (major2) < 17 || \ + (major1) == 4 && (major2) == 17 && (minor) <= 2) +#endif /* MIN_VERSION_base */ +/* package huffman-0.1 */ +#ifndef VERSION_huffman +#define VERSION_huffman "0.1" +#endif /* VERSION_huffman */ +#ifndef MIN_VERSION_huffman +#define MIN_VERSION_huffman(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 1 || \ + (major1) == 0 && (major2) == 1 && (minor) <= 0) +#endif /* MIN_VERSION_huffman */ + +/* tool gcc-13.2.0 */ +#ifndef TOOL_VERSION_gcc +#define TOOL_VERSION_gcc "13.2.0" +#endif /* TOOL_VERSION_gcc */ +#ifndef MIN_TOOL_VERSION_gcc +#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\ + (major1) < 13 || \ + (major1) == 13 && (major2) < 2 || \ + (major1) == 13 && (major2) == 2 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_gcc */ +/* tool ghc-9.4.7 */ +#ifndef TOOL_VERSION_ghc +#define TOOL_VERSION_ghc "9.4.7" +#endif /* TOOL_VERSION_ghc */ +#ifndef MIN_TOOL_VERSION_ghc +#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_ghc */ +/* tool ghc-pkg-9.4.7 */ +#ifndef TOOL_VERSION_ghc_pkg +#define TOOL_VERSION_ghc_pkg "9.4.7" +#endif /* TOOL_VERSION_ghc_pkg */ +#ifndef MIN_TOOL_VERSION_ghc_pkg +#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_ghc_pkg */ +/* tool haddock-2.27.0 */ +#ifndef TOOL_VERSION_haddock +#define TOOL_VERSION_haddock "2.27.0" +#endif /* TOOL_VERSION_haddock */ +#ifndef MIN_TOOL_VERSION_haddock +#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 27 || \ + (major1) == 2 && (major2) == 27 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_haddock */ +/* tool hpc-0.68 */ +#ifndef TOOL_VERSION_hpc +#define TOOL_VERSION_hpc "0.68" +#endif /* TOOL_VERSION_hpc */ +#ifndef MIN_TOOL_VERSION_hpc +#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 68 || \ + (major1) == 0 && (major2) == 68 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_hpc */ +/* tool hsc2hs-0.68.8 */ +#ifndef TOOL_VERSION_hsc2hs +#define TOOL_VERSION_hsc2hs "0.68.8" +#endif /* TOOL_VERSION_hsc2hs */ +#ifndef MIN_TOOL_VERSION_hsc2hs +#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\ + (major1) < 0 || \ + (major1) == 0 && (major2) < 68 || \ + (major1) == 0 && (major2) == 68 && (minor) <= 8) +#endif /* MIN_TOOL_VERSION_hsc2hs */ +/* tool pkg-config-2.0.2 */ +#ifndef TOOL_VERSION_pkg_config +#define TOOL_VERSION_pkg_config "2.0.2" +#endif /* TOOL_VERSION_pkg_config */ +#ifndef MIN_TOOL_VERSION_pkg_config +#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 0 || \ + (major1) == 2 && (major2) == 0 && (minor) <= 2) +#endif /* MIN_TOOL_VERSION_pkg_config */ +/* tool runghc-9.4.7 */ +#ifndef TOOL_VERSION_runghc +#define TOOL_VERSION_runghc "9.4.7" +#endif /* TOOL_VERSION_runghc */ +#ifndef MIN_TOOL_VERSION_runghc +#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\ + (major1) < 9 || \ + (major1) == 9 && (major2) < 4 || \ + (major1) == 9 && (major2) == 4 && (minor) <= 7) +#endif /* MIN_TOOL_VERSION_runghc */ +/* tool strip-2.41 */ +#ifndef TOOL_VERSION_strip +#define TOOL_VERSION_strip "2.41" +#endif /* TOOL_VERSION_strip */ +#ifndef MIN_TOOL_VERSION_strip +#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\ + (major1) < 2 || \ + (major1) == 2 && (major2) < 41 || \ + (major1) == 2 && (major2) == 41 && (minor) <= 0) +#endif /* MIN_TOOL_VERSION_strip */ + +#ifndef CURRENT_COMPONENT_ID +#define CURRENT_COMPONENT_ID "huffman-0.1-7oGsPwnMV4MIdxe92R26Zp-huffman-exe" +#endif /* CURRENT_COMPONENT_ID */ +#ifndef CURRENT_PACKAGE_VERSION +#define CURRENT_PACKAGE_VERSION "0.1" +#endif /* CURRENT_PACKAGE_VERSION */ + +#undef CURRENT_PACKAGE_KEY +#undef CURRENT_COMPONENT_ID diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.dyn_hi b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.dyn_hi index 34bdd9b..1a5d656 100644 Binary files a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.dyn_hi and b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.dyn_hi differ diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.hi b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.hi index 31f8184..ce9acb0 100644 Binary files a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.hi and b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/Huffman.hi differ diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a index 992d6c7..e66114b 100644 Binary files a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a and b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt.a differ diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so index f86bdc9..e5ee25c 100755 Binary files a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so and b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/lib/x86_64-linux-ghc-9.4.7/libHShuffman-0.1-FYSjga9JLF2kZjOZ6zeLt-ghc9.4.7.so differ diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt.conf b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt.conf index e74092c..8581485 100644 --- a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt.conf +++ b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/huffman-0.1-FYSjga9JLF2kZjOZ6zeLt.conf @@ -5,7 +5,7 @@ id: huffman-0.1-FYSjga9JLF2kZjOZ6zeLt key: huffman-0.1-FYSjga9JLF2kZjOZ6zeLt license: BSD-3-Clause synopsis: huffman -abi: 109d1f676886f1fb02e4494eaa1e8634 +abi: d6e2e1ad747b11372ae1e946a349112f exposed: True exposed-modules: Auxiliaries Huffman hidden-modules: Paths_huffman diff --git a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/package.cache b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/package.cache index 846a42a..83d4604 100644 Binary files a/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/package.cache and b/Aufgabe_6/code/.stack-work/install/x86_64-linux/fd8ac145ead3a583cca317bafb4c9c6398f22e51e51cd57da906cdb1a7b27beb/9.4.7/pkgdb/package.cache differ diff --git a/Aufgabe_6/code/.stack-work/stack.sqlite3 b/Aufgabe_6/code/.stack-work/stack.sqlite3 index 0a00e24..994b656 100644 Binary files a/Aufgabe_6/code/.stack-work/stack.sqlite3 and b/Aufgabe_6/code/.stack-work/stack.sqlite3 differ diff --git a/Aufgabe_6/code/Aaron.comp b/Aufgabe_6/code/Aaron.comp index 75f17e2..ccee939 100644 Binary files a/Aufgabe_6/code/Aaron.comp and b/Aufgabe_6/code/Aaron.comp differ diff --git a/Aufgabe_6/code/Aaron.txt b/Aufgabe_6/code/Aaron.txt index e6c8f6a..f32d818 100644 --- a/Aufgabe_6/code/Aaron.txt +++ b/Aufgabe_6/code/Aaron.txt @@ -3,4 +3,7 @@ Aaron Adrian Aaron Adrian Aaron Adrian Aaron Adrian +Aaron Adrian +Aaron Adrian +Aaron Adrian Aaron Adrian \ No newline at end of file diff --git a/Aufgabe_6/code/Aaron2.txt b/Aufgabe_6/code/Aaron2.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Aufgabe_6/code/AaronMoser_187648.zip b/Aufgabe_6/code/AaronMoser_187648.zip deleted file mode 100644 index 004e160..0000000 Binary files a/Aufgabe_6/code/AaronMoser_187648.zip and /dev/null differ diff --git a/Aufgabe_6/code/hitchhiker.comp b/Aufgabe_6/code/hitchhiker.comp new file mode 100644 index 0000000..46819e9 Binary files /dev/null and b/Aufgabe_6/code/hitchhiker.comp differ diff --git a/Aufgabe_6/code/src/Huffman.hs b/Aufgabe_6/code/src/Huffman.hs index d41c5c5..ea0e03f 100755 --- a/Aufgabe_6/code/src/Huffman.hs +++ b/Aufgabe_6/code/src/Huffman.hs @@ -6,8 +6,6 @@ import Data.Maybe (fromMaybe) import Data.Char (toUpper) import qualified Data.IntMap.Strict as IntMap import System.IO -import Data.List (maximumBy, minimumBy) -import Text.Printf (printf) type IntMap = IntMap.IntMap type Map = Map.Map @@ -20,6 +18,15 @@ type CodingTable = Map Char [Bit] data Node = Leaf Char Int | Inner Node Node Int deriving (Show) newtype HTree = Root Node deriving (Show) +getFrequency :: HTree -> Int +getFrequency (Root tree) = + case tree of + Leaf _ frequency -> frequency + Inner _ _ frequency -> frequency + +getNode :: HTree -> Node +getNode (Root node) = node + exercise1TreeValid :: HTree exercise1TreeValid = Root (Inner (Inner (Leaf 'E' 158) (Inner (Leaf 'N' 97) (Leaf 'I' 82) 179) 337) (Inner (Inner (Leaf 'R' 77) (Leaf 'S' 67) 144) (Inner (Leaf 'T' 64) (Leaf 'A' 61) 125) 269) 606) @@ -166,7 +173,7 @@ instance Eq HTree where buildHTree :: String -> HTree buildHTree input = let charFrequencyMap = combineFrequencies (addOccurences input) - in toHTree (toHTreeIntMap (toHTreeNodes charFrequencyMap)) (Root (Leaf 'A' 0)) + in toHTree (toHTreeIntMap (toHTreeNodes charFrequencyMap)) --map ['r','a','i','n','a'] becomes [('r',1),('a',1),('i',1),('n',1),('a',1)] addOccurences :: String -> [(Char,Int)] @@ -184,86 +191,43 @@ toHTreeNodes frequenciesMap = toHTreeIntMap :: [(Int, [HTree])] -> IntMap [HTree] toHTreeIntMap = IntMap.fromListWith (++) -toHTree :: IntMap [HTree] -> HTree -> HTree -toHTree map lastTree = - let Root lastTreeRoot = lastTree - in case lastTreeRoot of - Leaf _ lastTreeRootFrequency -> - case IntMap.minView map of - Just (minimums, newMap) -> - case minimums of - [] -> toHTree newMap lastTree - [x] -> - let Root xRoot = x - in case xRoot of - Leaf _ xFrequency -> - if lastTreeRootFrequency == 0 - then toHTree newMap x - else if lastTreeRootFrequency < xFrequency - then toHTree newMap (Root (Inner lastTreeRoot xRoot (lastTreeRootFrequency + xFrequency))) - else toHTree newMap (Root (Inner xRoot lastTreeRoot (lastTreeRootFrequency + xFrequency))) - Inner _ _ xFrequency -> - if lastTreeRootFrequency == 0 - then toHTree newMap x - else if lastTreeRootFrequency < xFrequency - then toHTree newMap (Root (Inner lastTreeRoot xRoot (lastTreeRootFrequency + xFrequency))) - else toHTree newMap (Root (Inner xRoot lastTreeRoot (lastTreeRootFrequency + xFrequency))) - (x:y:rest) -> - let Root xRoot = x - Root yRoot = y - in case xRoot of - Leaf _ xFrequency -> - if lastTreeRootFrequency == 0 - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner xRoot yRoot (xFrequency * 2))) - else if lastTreeRootFrequency < xFrequency - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner lastTreeRoot (Inner xRoot yRoot (xFrequency * 2)) (lastTreeRootFrequency + (xFrequency * 2)))) - else toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner (Inner xRoot yRoot (xFrequency * 2)) lastTreeRoot (lastTreeRootFrequency + (xFrequency * 2)))) - Inner _ _ xFrequency -> - if lastTreeRootFrequency == 0 - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner xRoot yRoot (xFrequency * 2))) - else if lastTreeRootFrequency < xFrequency - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner lastTreeRoot (Inner xRoot yRoot (xFrequency * 2)) (lastTreeRootFrequency + (xFrequency * 2)))) - else toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner (Inner xRoot yRoot (xFrequency * 2)) lastTreeRoot (lastTreeRootFrequency + (xFrequency * 2)))) - _ -> lastTree - Inner _ _ lastTreeRootFrequency -> - case IntMap.minView map of - Just (minimums, newMap) -> - case minimums of - [] -> toHTree newMap lastTree - [x] -> - let Root xRoot = x - in case xRoot of - Leaf _ xFrequency -> - if lastTreeRootFrequency < xFrequency - then toHTree newMap (Root (Inner lastTreeRoot xRoot (lastTreeRootFrequency + xFrequency))) - else toHTree newMap (Root (Inner xRoot lastTreeRoot (lastTreeRootFrequency + xFrequency))) - Inner _ _ xFrequency -> - if lastTreeRootFrequency < xFrequency - then toHTree newMap (Root (Inner lastTreeRoot xRoot (lastTreeRootFrequency + xFrequency))) - else toHTree newMap (Root (Inner xRoot lastTreeRoot (lastTreeRootFrequency + xFrequency))) - (x:y:rest) -> - let Root xRoot = x - Root yRoot = y - in case xRoot of - Leaf _ xFrequency -> - if lastTreeRootFrequency < xFrequency - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner lastTreeRoot (Inner xRoot yRoot (xFrequency * 2)) (lastTreeRootFrequency + (xFrequency * 2)))) - else toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner (Inner xRoot yRoot (xFrequency * 2)) lastTreeRoot (lastTreeRootFrequency + (xFrequency * 2)))) - Inner _ _ xFrequency -> - if lastTreeRootFrequency < xFrequency - then toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner lastTreeRoot (Inner xRoot yRoot (xFrequency * 2)) (lastTreeRootFrequency + (xFrequency * 2)))) - else toHTree (IntMap.insert xFrequency rest newMap) (Root (Inner (Inner xRoot yRoot (xFrequency * 2)) lastTreeRoot (lastTreeRootFrequency + (xFrequency * 2)))) - _ -> lastTree +intMapAaron :: IntMap [HTree] +intMapAaron = IntMap.fromListWith (++) [(1,[Root (Leaf 'A' 1)]),(1,[Root (Leaf 'a' 1)]),(1,[Root (Leaf 'r' 1)]),(1,[Root (Leaf 'o' 1)]),(1,[Root (Leaf 'n' 1)])] + +intMapB :: IntMap [HTree] +intMapB = IntMap.fromListWith (++) [(3,[Root (Leaf 'A' 3)]),(1,[Root (Leaf 'a' 1)]),(1,[Root (Leaf 'r' 1)]),(2,[Root (Leaf 'o' 2)]),(4,[Root (Leaf 'n' 4)])] + +toHTree :: IntMap [HTree] -> HTree +toHTree map = + case IntMap.minView map of + Just (minimums, newMap) -> + case minimums of + [] -> + if IntMap.size newMap > 0 + then toHTree newMap + else (Root (Leaf 'A' 0)) + [x] -> + case IntMap.minView newMap of + Just (minimums2, newMap2) -> + case minimums2 of + [] -> x + (y:rest) -> toHTree (IntMap.insertWith (++) (getFrequency x + getFrequency y) [Root (Inner (getNode x) (getNode y) (getFrequency x + getFrequency y))] (IntMap.insertWith (++) (getFrequency y) rest newMap2)) + _ -> x + (x:y:rest) -> + toHTree (IntMap.insertWith (++) (getFrequency x + getFrequency y) [Root (Inner (getNode x) (getNode y) (getFrequency x + getFrequency y))] (IntMap.insertWith (++) (getFrequency x) rest newMap)) + _ -> case IntMap.maxView map of + Just (maximums, _) -> head maximums + _ -> (Root (Leaf ' ' 0)) ----------------------------------------------------------------------- -- Aufgabe 7 Test ----------------------------------------------------------------------- treeAaron :: HTree -treeAaron = Root (Inner (Leaf 'A' 1) (Inner (Inner (Leaf 'n' 1) (Leaf 'a' 1) 2) (Inner (Leaf 'r' 1) (Leaf 'o' 1) 2) 4) 5) +treeAaron = Root (Inner (Inner (Leaf 'r' 1) (Leaf 'o' 1) 2) (Inner (Leaf 'A' 1) (Inner (Leaf 'n' 1) (Leaf 'a' 1) 2) 3) 5) treeMISSISSIPPI :: HTree -treeMISSISSIPPI = Root (Inner (Inner (Leaf 'M' 1) (Leaf 'P' 2) 3) (Inner (Leaf 'S' 4) (Leaf 'I' 4) 8) 11) +treeMISSISSIPPI = Root (Inner (Leaf 'I' 4) (Inner (Inner (Leaf 'M' 1) (Leaf 'P' 2) 3) (Leaf 'S' 4) 7) 11) treeAAABC :: HTree treeAAABC = Root (Inner (Inner (Leaf 'C' 1) (Leaf 'B' 1) 2) (Leaf 'A' 3) 5) @@ -272,42 +236,26 @@ treeAAABC = Root (Inner (Inner (Leaf 'C' 1) (Leaf 'B' 1) 2) (Leaf 'A' 3) 5) -- Aufgabe 8 ----------------------------------------------------------------------- ---type CodingTable = Map Char [Bit] -type Depth = Int - toDecodeTree :: CodingTable -> HTree -toDecodeTree table = - let listWithDepth = (codingListToCodingListWithDepth (codingTableToList table)) - listWithDepthInverted = invertDepths listWithDepth (getMinimumDepth listWithDepth) (getMaximumDepth listWithDepth) - in buildHTree (depthListToString listWithDepthInverted) +toDecodeTree table = foldl1 mergeTrees $ map (uncurry partTree) (Map.toList table) -depthListToString :: [(Char, Depth)] -> String -depthListToString list = - case list of - [] -> "" - ((char, depth):rest) -> (replicate depth char) ++ depthListToString rest +partTree :: Char -> [Bit] -> HTree +partTree char bits = + case bits of + [] -> Root (Leaf char 0) + (x:rest) -> + let next = partTree char rest in + case x of + Zero -> Root (Inner (getNode next) (Leaf 'e' 1) 0) + One -> Root (Inner (Leaf 'e' 1) (getNode next) 0) -invertDepths :: [(Char, Depth)] -> Depth -> Depth -> [(Char, Depth)] -invertDepths list minDepth maxDepth = map (\(char, depth) -> (char, (minDepth + maxDepth - depth))) list - -codingTableToList :: CodingTable -> [(Char, [Bit])] -codingTableToList table = Map.toList table - -codingListToCodingListWithDepth :: [(Char, [Bit])] -> [(Char, Depth)] -codingListToCodingListWithDepth tableList = - map (\(char, bitList) -> (char, length bitList)) tableList - -getMaximumDepth :: [(Char, Depth)] -> Depth -getMaximumDepth = (\(_, d) -> d) . maximumBy compareByDepth - -getMinimumDepth :: [(Char, Depth)] -> Depth -getMinimumDepth = (\(_, d) -> d) . minimumBy compareByDepth - -compareByDepth :: (Char, Depth) -> (Char, Depth) -> Ordering -compareByDepth (_, depth1) (_, depth2) - | depth1 < depth2 = LT - | depth1 > depth2 = GT - | otherwise = EQ +mergeTrees :: HTree -> HTree -> HTree +mergeTrees (Root (Leaf char1 0)) (Root (Leaf char2 0)) = Root (Inner (Leaf char1 0) (Leaf char2 0) 0) +mergeTrees (Root (Leaf char 0)) (Root (Leaf 'e' 1)) = Root (Leaf char 0) +mergeTrees (Root (Leaf 'e' 1)) (Root (Leaf char 0)) = Root (Leaf char 0) +mergeTrees (Root (Inner left1 right1 _)) (Root (Inner left2 right2 _)) = Root (Inner (getNode (mergeTrees (Root left1) (Root left2))) (getNode (mergeTrees (Root right1) (Root right2))) 0) +mergeTrees (Root (Leaf _ _)) right = right +mergeTrees left (Root (Leaf _ _)) = left ----------------------------------------------------------------------- -- Aufgabe 8 Test @@ -317,7 +265,7 @@ testCodingTable :: CodingTable testCodingTable = Map.fromList [('E', [Zero,Zero]), ('N', [Zero,One,Zero]), ('I', [Zero,One,One]), ('R', [One,Zero,Zero]), ('S', [One,Zero,One]), ('T', [One,One,Zero]), ('A', [One,One,One])] testCodingTableHTree :: HTree -testCodingTableHTree = Root (Inner (Leaf 'E' 3) (Inner (Inner (Leaf 'I' 2) (Leaf 'A' 2) 4) (Inner (Inner (Leaf 'R' 2) (Leaf 'N' 2) 4) (Inner (Leaf 'T' 2) (Leaf 'S' 2) 4) 8) 12) 15) +testCodingTableHTree = Root (Inner (Inner (Leaf 'E' 0) (Inner (Leaf 'N' 0) (Leaf 'I' 0) 0) 0) (Inner (Inner (Leaf 'R' 0) (Leaf 'S' 0) 0) (Inner (Leaf 'T' 0) (Leaf 'A' 0) 0) 0) 0) ----------------------------------------------------------------------- -- Aufgabe 9 @@ -331,11 +279,7 @@ encodeFile input output = codingTable = toCodingTable htree encodedContent = encode codingTable inputContent fileContent = FileContent {fc_codingTable = (map (\(char, bitList) -> (char, Bitlist bitList)) (Map.toList codingTable)), fc_content = (Bitlist encodedContent)} - in do - printf ("\n" ++ show htree ++ "\n") - --printf (show codingTable ++ "\n") - --printf (show encodedContent ++ "\n") - binaryToFile output fileContent + in do binaryToFile output fileContent decodeFile :: FilePath -> FilePath -> IO () decodeFile input output = do @@ -344,9 +288,7 @@ decodeFile input output = do encodedContent = fc_content fileContent decodeTree = toDecodeTree (Map.fromList (map (\(char, Bitlist bitList) -> (char, bitList)) codingTable)) decodedString = decode decodeTree (bitlistToList encodedContent) - in do - printf ("\n" ++ show decodeTree) - withFile output WriteMode (\handle -> do hPutStr handle decodedString) + in do withFile output WriteMode (\handle -> do hPutStr handle decodedString) bitlistToList :: Bitlist -> [Bit] bitlistToList (Bitlist bits) = bits \ No newline at end of file diff --git a/Aufgabe_6/code/test/Tests.hs b/Aufgabe_6/code/test/Tests.hs index 2fa248d..d9a6812 100755 --- a/Aufgabe_6/code/test/Tests.hs +++ b/Aufgabe_6/code/test/Tests.hs @@ -37,7 +37,7 @@ test_buildHTree = do assertEqual "test buildHTree" treeMISSISSIPPI (buildHTree "MISSISSIPPI") assertEqual "test buildHTree" treeAaron (buildHTree "Aaron") assertEqual "test buildHTree" treeAAABC (buildHTree "AAABC") - assertEqual "test buildHTree" (Root (Leaf 'A' 0)) (buildHTree "") + assertEqual "test buildHTree" (Root (Leaf ' ' 0)) (buildHTree "") assertEqual "test buildHTree" (Root (Leaf 'A' 1)) (buildHTree "A") test_toDecodeTree :: IO () @@ -48,9 +48,9 @@ test_toFromWord8 :: IO () test_toFromWord8 = pure () test_encodeDecodeFile :: IO () -test_encodeDecodeFile = do - _ <- encodeFile "Aaron.txt" "Aaron.comp" - decodeFile "Aaron.comp" "Aaron2.txt" +test_encodeDecodeFile = pure() --do + --_ <- encodeFile "hitchhiker.txt" "hitchhiker.comp" +-- decodeFile "hitchhiker.comp" "hitchhiker2.txt" allTests :: Test allTests =