{"id":16711795,"url":"https://github.com/bburdette/toop","last_synced_at":"2025-03-15T04:13:46.638Z","repository":{"id":45954197,"uuid":"182889157","full_name":"bburdette/toop","owner":"bburdette","description":"tuple-like datastructure allowing more than 3 elements","archived":false,"fork":false,"pushed_at":"2021-11-24T21:42:31.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T19:51:15.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bburdette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-23T00:30:41.000Z","updated_at":"2021-11-24T21:40:58.000Z","dependencies_parsed_at":"2022-09-10T16:41:18.620Z","dependency_job_id":null,"html_url":"https://github.com/bburdette/toop","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Ftoop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Ftoop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Ftoop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bburdette%2Ftoop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bburdette","download_url":"https://codeload.github.com/bburdette/toop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243681077,"owners_count":20330155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:26:33.449Z","updated_at":"2025-03-15T04:13:46.615Z","avatar_url":"https://github.com/bburdette.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toop \n\nA set of tuple-like data structures that allow more than 3 elements.\n\nThe main thing I use Toop for is in case statements, to pattern match \nmultiple things at once:\n\n```elm\n\nimport Toop\n\ncase Toop.T4 mba mbb mbc mbd of \n  Toop.T4 (Just a) (Just b) (Just c) (Just d) -\u003e \n    -- we've got all the things!\n  _ -\u003e \n    -- failure to get all the things.\n\n```\n\n## applyT\u003cn\u003e functions.\n\napply calls a function using the Toop elements as the arguments.\n\n```elm\n\nargs = Toop.T6 \"this\" 5 \"that\" 6 (\u003c) \"less than\"\n\ncomp name1 val1 name2 val2 op opname =\n  if op val1 val2 then\n    name1 ++ \" is \" ++ opname  ++ name2\n  else\n    name2 ++ \" is \" ++ opname  ++ name1\n\nresultString = Toop.Apply.applyT6 comp args\n\n```\n\n## takeT\u003cn\u003e functions:\n\n```elm\n\nnums = [1 3 5 2 4 6 8 9]\n\nfiveDmath : Toop.T5 Float Float Float Float Float\nfiveDmath args =\n  -- some kind of calculation involving exactly 5 numbers\n\nmbresult = (Toop.Take.takeT5 nums) |\u003e Maybe.map fiveDmath\n\n```\n\n## resT\u003cn\u003e functions:\n\n```elm\n\ntype EditState \n    = MyEdit { uid: Uuid, group: UUID, doc: UUID }\n    | Failed String\n\n\nToEdit : String -\u003e String -\u003e String -\u003e EditState\nToEdit uid group doc =\n    Toop.T3 (UUID.fromString uid) (UUID.fromString group) (UUID.fromString doc)\n        |\u003e resT3\n        |\u003e Result.map\n            (\\(Toop.T3 uidid groupid docid) -\u003e\n                MyEdit { uid = uidid, group = groupid, doc = docid }\n            )\n        |\u003e Result.withDefault Failed \"invalid uuid\"\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbburdette%2Ftoop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbburdette%2Ftoop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbburdette%2Ftoop/lists"}