brickisaHaskellterminaluserinterface(TUI)programmingtoolkit.Touseit,youwriteapurefunctionthatdescribeshowyouruserinterfaceshouldlookbasedonyourcurrentapplicationstateandyouprovideastatetransformationfunctiontohandleevents.
brickexposesadeclarativeAPI.UnlikemostGUItoolkitswhichrequireyoutowritealongandtedioussequenceof"createawidget,nowbindaneventhandler",brickjustrequiresyoutodescribeyourinterfaceusingasetofdeclarativelayoutcombinators.
Underthehood,thislibrarybuildsuponvty,sosomeknowledgeofVtywillbehelpfulinusingthislibrary.
ExampleHere'sanexampleinterface(seeprograms/ReadmeDemo.hs):
withBorderStyleunicode$borderWithLabel(str"Hello!")$(center(str"Left")<+>vBorder<+>center(str"Right"))Result:
┌─────────Hello!─────────┐│││││││Left│Right│││││││└────────────────────────┘FeaturedProjectsTogetanideaofwhatsomepeoplehavedonewithbrick,takealookattheseprojects.Ifyouhavemadesomethingandwouldlikemetoincludeit,getintouch!
ProjectDescriptiontetrisAnimplementationoftheTetrisgamegotta-go-fastAtypingtutorhaskell-playerAnafplayfrontendmushuAnMPDclientmatterhornAclientforMattermostviewprofAGHCprofileviewertartAmouse-drivenASCIIartdrawingprogramsilly-joyAninterpreterforJoyhermsAcommand-linetoolformanagingkitchenrecipespurebredAmailuseragent2048HaskellAnimplementationofthe2048gamebhoogleAHoogleclientclifmAfilemanagertowerHanoiAnimatedsolutionstoTheTowerofHanoiVOIDSPACEAspace-themedtyping-tutorgamesolitaireThecardgamesudoku-tuiASudokuimplementationsummoner-tuiAninteractivefrontendtotheSummonertoolwrapping-editorAnembeddableeditorwithsupportforBrickgit-brunchAgitbranchcheckoututilityhascardAprogramforreviewing"flashcard"notesttymeATUIforHarvestghcupATUIforghcup,theHaskelltoolchainmanagercbookviewATUIforexploringpolyglotchessopeningbookfilesthockAmodernTUItypinggamefeaturingonlineracingagainstfriendsfifteenAnimplementationofthe15puzzlemazeABrick-basedmazegamepboyAtinyPDForganizerhyahtzee2FamousYahtzeedicegamebrewsageATUIforHomebrewsandwichAtestframeworkwithaTUIinterfaceyoubrickAfeedaggregatorandlauncherforYoutubechannelsswarmA2DprogrammingandresourcegatheringgameThesethird-partypackagesalsoextendbrick:
ProjectDescriptionbrick-filetree[Hackage]AwidgetforexploringadirectorytreeandselectingorflaggingfilesanddirectoriesReleaseAnnouncements/NewsFindoutaboutbrickreleasesandothernewsonTwitter:
https://twitter.com/brick_haskell/
GettingStartedCheckoutthemanydemoprogramstogetafeelfordifferentaspectsofthelibrary:
$cabalnew-build-fdemos$finddist-newstyle-typef-name\*-demoTogetstarted,seetheuserguide.
DocumentationDocumentationforbrickcomesinavarietyofforms:
TheofficialbrickuserguideSamuelTay'sbricktutorialHaddock(allmodules)Demoprograms(Screenshots)FAQFeatureOverviewbrickcomeswithabunchofbatteriesincluded:
VerticalandhorizontalboxlayoutwidgetsBasicsingle-andmulti-linetexteditorwidgetsListwidgetProgressbarwidgetSimpledialogboxwidgetBorder-drawingwidgets(putbordersaroundorinbetweenthings)GenericscrollableviewportsGeneral-purposelayoutcontrolcombinatorsExtensiblewidget-buildingAPIUser-customizableattributethemesType-safe,validatedinputformAPI(seetheBrick.Formsmodule)AfilesystembrowserforfileanddirectoryselectionBorderscanbeconfiguredtoautomaticallyconnect!Brick-UsersDiscussionThebrick-usersGoogleGroup/e-maillistisaplacetodiscusslibrarychanges,givefeedback,andaskquestions.Youcansubscribeat:
https://groups.google.com/group/brick-users
StatusTherearesomeplaceswereIhavedeliberatelychosentoworryaboutperformancelaterforthesakeofspendingmoretimeonthedesign(andtowaitonperformanceissuestoarisefirst).brickisalsosomethingofanexperimentalprojectofmineandsomeaspectsofthedesigninvolvetrade-offsthatmightnotberightforyourapplication.Brickisnotintendedtobeallthingstoallpeople;rather,Iwantittoprovideagoodfoundationforbuildingcomplexterminalinterfacesinadeclarativestyletotakeawayspecificheadachesofbuilding,modifying,andworkingwithsuchinterfaces,allwhileseeinghowfarwecangetwithapurefunctiontospecifytheinterface.
brickexportsanextensionAPIthatmakesitpossibletomakeyourownpackagesandwidgets.Ifyouusethat,you'llalsobehelpingtotestwhethertheexportedinterfaceisusableandcomplete!
ReportingbugsPleasefilebugreportsasGitHubissues.Forbestresults:
Includetheversionsofrelevantsoftwarepackages:yourterminalemulator,brick,ghc,andvtywillbethemostimportantones.
Clearlydescribethebehavioryouexpected...
...andincludeaminimaldemonstrationprogramthatexhibitsthebehavioryouactuallyobserved.
ContributingIfyoudecidetocontribute,that'sgreat!Herearesomeguidelinesyoushouldconsidertomakesubmittingpatcheseasierforallconcerned:
Ifyouwanttotakeonbigthings,talktomefirst;let'shaveadesign/visiondiscussionbeforeyoustartcoding.CreateaGitHubissueandwecanusethatastheplacetohashthingsout.PleasemakechangesconsistentwiththeconventionsI'veusedinthecodebase.PleaseadjustorprovideHaddockand/oruserguidedocumentationrelevanttoanychangesyoumake.Newcommitsshouldbe-Wallclean.PleasedoNOTincludepackageversionchangesinyourpatches.Packageversionchangesareonlydoneatreleasetimewhenthefullscopeofarelease'schangescanbeevaluatedtodeterminetheappropriateversionchange.
评论