Compare commits
	
		
			No commits in common. "3ff0dc79d5a25a6236bdeac1659230494223e0cf" and "7d7f6281756bcf9f3c630b30a1ccd29fb1be11eb" have entirely different histories.
		
	
	
		
			3ff0dc79d5
			...
			7d7f628175
		
	
		
							
								
								
									
										10
									
								
								app/Main.hs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								app/Main.hs
									
									
									
									
									
								
							| @ -13,9 +13,6 @@ | ||||
| 
 | ||||
| module Main (main) where | ||||
| 
 | ||||
| import Control.DeepSeq (force) | ||||
| import Control.Exception (evaluate) | ||||
| import Control.Monad (void) | ||||
| import Data.Char (chr) | ||||
| import Data.FileEmbed (embedFile) | ||||
| import Data.Foldable (for_) | ||||
| @ -58,12 +55,7 @@ import qualified UToy.Names as Names | ||||
| import qualified UToy.Parsers as Parsers | ||||
| 
 | ||||
| main :: IO () | ||||
| main = do | ||||
|   -- Forced evaluation of Names.lowerNames to reduce number of thunks. | ||||
|   putStrLn "* Building search index" | ||||
|   void $ evaluate $ force Names.lowerNames | ||||
|   putStrLn "* Listening on http://localhost:3000" | ||||
|   Warp.run 3000 app | ||||
| main = Warp.run 3000 app | ||||
| 
 | ||||
| app :: Application | ||||
| app = serve (Proxy :: Proxy API) server | ||||
|  | ||||
							
								
								
									
										40
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										40
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @ -1,30 +1,12 @@ | ||||
| { | ||||
|   "nodes": { | ||||
|     "flake-utils": { | ||||
|       "inputs": { | ||||
|         "systems": "systems" | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1731533236, | ||||
|         "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", | ||||
|         "owner": "numtide", | ||||
|         "repo": "flake-utils", | ||||
|         "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "numtide", | ||||
|         "repo": "flake-utils", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs": { | ||||
|       "locked": { | ||||
|         "lastModified": 1751290243, | ||||
|         "narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=", | ||||
|         "lastModified": 1740243248, | ||||
|         "narHash": "sha256-GJ/fV5AE+4i38/eXmAgBZs4lKYXfScpxPYviUV8ujlk=", | ||||
|         "owner": "nixos", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6", | ||||
|         "rev": "a6c4bfe37c51686c042b4bdb4e650a9414e96680", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @ -36,24 +18,8 @@ | ||||
|     }, | ||||
|     "root": { | ||||
|       "inputs": { | ||||
|         "flake-utils": "flake-utils", | ||||
|         "nixpkgs": "nixpkgs" | ||||
|       } | ||||
|     }, | ||||
|     "systems": { | ||||
|       "locked": { | ||||
|         "lastModified": 1681028828, | ||||
|         "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", | ||||
|         "owner": "nix-systems", | ||||
|         "repo": "default", | ||||
|         "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "nix-systems", | ||||
|         "repo": "default", | ||||
|         "type": "github" | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "root": "root", | ||||
|  | ||||
							
								
								
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							| @ -2,55 +2,37 @@ | ||||
|   description = "Unicode toy"; | ||||
| 
 | ||||
|   inputs.nixpkgs.url = "github:nixos/nixpkgs/release-24.11"; | ||||
|   inputs.flake-utils.url = "github:numtide/flake-utils"; | ||||
| 
 | ||||
|   outputs = { self, nixpkgs, flake-utils }: | ||||
|   flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux" "aarch64-darwin"] (system: | ||||
|   outputs = { self, nixpkgs }: | ||||
|     let | ||||
|         pkgs = import nixpkgs { inherit system; }; | ||||
|       pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||||
| 
 | ||||
|         inherit (pkgs.haskell.lib) compose; | ||||
| 
 | ||||
|         # Fix broken unicode-data-names by overriding the version of the unicode-data package. | ||||
|         haskellPackagesOverrides = self: super: { | ||||
|       utoy = pkgs.haskellPackages.developPackage { | ||||
|         root = ./.; | ||||
|         overrides = self: super: { | ||||
|           unicode-data = super.unicode-data_0_6_0; | ||||
|           unicode-data-names = pkgs.haskell.lib.markUnbroken super.unicode-data-names; | ||||
|         }; | ||||
| 
 | ||||
|         utoy = pkgs.lib.pipe | ||||
|           # The basic package | ||||
|           (pkgs.haskellPackages.developPackage { | ||||
|             root = ./.; | ||||
|             overrides = haskellPackagesOverrides; | ||||
|           }) | ||||
|           # And some build configuration. | ||||
|           # See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers. | ||||
|           [ | ||||
|             # Remove warp which pulls GHC into the runtime deps for some reason. | ||||
|             (compose.overrideCabal (drv: { | ||||
|               postInstall = '' | ||||
|                 remove-references-to -t ${pkgs.haskellPackages.warp} $out/bin/utoy | ||||
|               ''; | ||||
|             })) | ||||
|             # Return only the bin folder to curb image size | ||||
|             compose.justStaticExecutables | ||||
|           ]; | ||||
|       }; | ||||
|     in { | ||||
|         packages = rec { | ||||
|       packages.x86_64-linux = rec { | ||||
|         docker = | ||||
|           pkgs.dockerTools.buildImage { | ||||
|             name = "git.pbrinkmeier.de/paul/utoy"; | ||||
|             tag = utoy.version; | ||||
|               config.Cmd = [ "${utoy}/bin/utoy" ]; | ||||
|             config.Cmd = [ "${pkgs.haskell.lib.justStaticExecutables utoy}/bin/utoy" ]; | ||||
|           }; | ||||
| 
 | ||||
|         default = utoy; | ||||
|       }; | ||||
| 
 | ||||
|         devShells.default = | ||||
|       devShells.x86_64-linux.default = | ||||
|         (pkgs.haskellPackages.developPackage { | ||||
|           root = ./.; | ||||
|             overrides = haskellPackagesOverrides; | ||||
|           overrides = self: super: { | ||||
|             unicode-data = super.unicode-data_0_6_0; | ||||
|             unicode-data-names = pkgs.haskell.lib.markUnbroken super.unicode-data-names; | ||||
|           }; | ||||
|           modifier = drv: | ||||
|             pkgs.haskell.lib.addBuildTools drv [ | ||||
|               pkgs.cabal-install | ||||
| @ -59,5 +41,5 @@ | ||||
|             ]; | ||||
|           cabal2nixOptions = "--benchmark"; | ||||
|         }).env; | ||||
|         }); | ||||
|   }; | ||||
| } | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| module UToy.Names (allNames, blockName, lowerNames, searchCaseInsensitive) where | ||||
| module UToy.Names (allNames, blockName, searchCaseInsensitive) where | ||||
| 
 | ||||
| import Data.Char (ord) | ||||
| import Data.Maybe (maybeToList) | ||||
| @ -25,7 +25,7 @@ searchCaseInsensitive search = filter go [minBound..maxBound] | ||||
|     go c = any matches $ Vector.unsafeIndex lowerNames (ord c - ord minBound) | ||||
|     matches t = Text.toLower search `Text.isInfixOf` t | ||||
| 
 | ||||
| lowerNames :: Vector (Vector Text) | ||||
| lowerNames :: Vector [Text] | ||||
| lowerNames = Vector.fromList $ map go [minBound..maxBound] | ||||
|   where | ||||
|     go = Vector.fromList . map Text.toLower . allNames | ||||
|     go = map Text.toLower . allNames | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| cabal-version: 1.12 | ||||
| 
 | ||||
| name:           utoy | ||||
| version:        0.6.3 | ||||
| version:        0.6.2 | ||||
| author:         Paul Brinkmeier | ||||
| maintainer:     hallo@pbrinkmeier.de | ||||
| copyright:      2023 Paul Brinkmeier | ||||
| @ -46,7 +46,6 @@ executable utoy | ||||
|     , base >=4.7 && <5 | ||||
|     , blaze-html | ||||
|     , bytestring | ||||
|     , deepseq | ||||
|     , file-embed | ||||
|     , http-media | ||||
|     , servant-server | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user